Jump to content

[SOLVED] Code to help choose "a" or "an"


katarra

Recommended Posts

This is how I'm using it. The function up above works excellent. I just can't seem to call it correctly down here in the form.

 

<td>
      <div align="left">
        <?=$name?> is a member of the <?=$race?>. 
        <?=$HeShe?> has been trained as <?=getAdj($class)?> <?=$class?>. </div>
        <p align="left"><?=$wep?> <?=$arm?></p></td>

Link to comment
Share on other sites

<?
$command = 1;
$peep = ucwords(strtolower($action3[2]));
$peepsname = getuser($peep,"name");
$peeps = getlevel(get("plane"),coords(),"pcs");
$pflags = getuser($peep,"flags");

function getAdj($class) {
  $array['a'] = array('hunter','Royal');
  $array['an'] = array('assassin','entertainer','alchemist');
  foreach($array as $k => $v)
    if (in_array(($class),$v)) return $k;
  return '';
}

$a = array('hunter','entertainer','Royal','assassin','alchemist');

foreach ($a as $class) {
  echo "Adam appears to be " . getAdj($class) . " " . $class . "<br/>";
}


if ($peep != $username && (strpos($peeps,"$peep:") === false || strpos(getuser($peep,"flags"),"(invis)") !== false)) echo("You do not see $peep here."); else{
$name = "<i>".getuser($peep,"name")."</i>";
$race = "<i>".getuser($peep,"race")."</i>";
$gender = getuser($peep,"gender");
if ($gender == "male"){
	$HeShe = "He";
	$heshe = "he";
	$hisher = "his";
}else if ($gender == "female"){
	$HeShe = "She";
	$heshe = "she";
	$hisher = "her";
}else{
	$HeShe = "It";
	$heshe = "it";
	$hisher = "its";
}
if (getuser($peep,"guild") == "") $guild = "$name is not a member of a guild.";
else $guild = "$name is a member of the guild <i>".getuser($peep,"guild")."</i>.";

$gender = "<i>$gender</i>";
$home = "<i>".getuser($peep,"hometown")."</i>";
$eyes = "<i>".getuser($peep,"eyes")."</i>";
$hair = "<i>".getuser($peep,"hair")."</i>";
$skin = "<i>".getuser($peep,"skin")."</i>";
$height = "<i>".getuser($peep,"height")."</I>";
$build = "<i>".getuser($peep,"build")."</i>";
$class = "<i>".getuser($peep,"class")."</i>";
$wep = getuser($peep,"weapon");
if($wep)$wep="$name is wielding a <i>$wep</i>.";else $wep="$name has <i>no weapon</i>.";
$ret = "";
if ($peep == $username){
	$petdata = getuser($peep,"pet");
	$ret = "The ".get("race")." known as ".get("name")." is here";
	if ($petdata[1] != "") $ret .= " with ".get("pet");
	$ret .= ".<br><br>\n";
}
$other = "";
$spouse = getuser($peep,"spouse");
if ($spouse == "none") $spouse = "not married.";
else $spouse = "married to <i>".getuser($spouse,"name")."</i>. ";
$shield="<i>".getuser($peep,"shield")."</i>";if($shield=="<i></i>")$shield="<i>nothing</i>";
$head="<i>".getuser($peep,"head")."</i>";if($head=="<i></i>")$head="<i>nothing</i>";
$neck="<i>".getuser($peep,"neck")."</i>";if($neck=="<i></i>")$neck="<i>nothing</i>";
$body="<i>".getuser($peep,"body")."</i>";if($body=="<i></i>")$body="<i>nothing</i>";
$leftarm="<i>".getuser($peep,"leftarm")."</i>";if($leftarm=="<i></i>")$leftarm="<i>nothing</i>";
$rightarm="<i>".getuser($peep,"rightarm")."</i>";if($rightarm=="<i></i>")$rightarm="<i>nothing</i>";
$wrists="<i>".getuser($peep,"wrists")."</i>";if($wrists=="<i></i>")$wrists="<i>nothing</i>";
$hands="<i>".getuser($peep,"hands")."</i>";if($hands=="<i></i>")$hands="<i>nothing</i>";
$leftfinger="<i>".getuser($peep,"leftfinger")."</i>";if($leftfinger=="<i></i>")$leftfinger="<i>nothing</i>";
$rightfinger="<i>".getuser($peep,"rightfinger")."</i>";if($rightfinger=="<i></i>")$rightfinger="<i>nothing</i>";
$legs="<i>".getuser($peep,"legs")."</i>";if($legs=="<i></i>")$legs="<i>nothing</i>";
$feet="<i>".getuser($peep,"feet")."</i>";if($feet=="<i></i>")$feet="<i>nothing</i>";
$arm="$HeShe has $shield equipped for a shield, $head on $hisher head, $neck around $hisher neck and $body on $hisher body. $HeShe is also wearing $leftarm on $hisher left arm and a $rightarm on $hisher right arm. $HeShe has equipped $wrists on $hisher wrists, $hands on $hisher hands, $leftfinger on $hisher left finger and a $rightfinger on $hisher right finger. $HeShe has $legs on $hisher legs and $feet on $hisher feet. $HeShe is $spouse";
if(strpos(getuser($peep,"flags"),"(equip)")===false)$arm="";
if ($peep != $username){
	$myname = get("name");
	set("chat",get("chat")."<b><font class=self>You looked at $peepsname.</font></b><br>\n");
	$chardata = explode(":",getlevel(get("plane"),coords(),"pcs"));
	$numchars = count($chardata);
	for ($i = 0; $i < $numchars; $i++){
		if ($chardata[$i] != $username && $chardata[$i] != ""){
			$peepname = $chardata[$i];
			$cp = getuser($peepname,"chatpref");
			if ($chardata[$i] == $peep){$peepchat = "<b>$myname looked at you.</b><br>\n"; if ($cp[10] == 1) setuser($peepname,"newchat",1);}
			else if(strpos(getuser($peepname,"friends"),"$username:") !== false) $peepchat = "<font class=friends>$myname looked at $peepsname.</font><br>\n";
			else $peepchat = "$myname looked at $peepsname.<br>\n";
			setuser($peepname,"chat",getuser($peepname,"chat").$peepchat);
			if ($chardata[$i] != $peep && $cp[11] == 1) setuser($peepname,"newchat",1);
		}
	}
}
}
?>
<table width="85%" border="0" cellpadding="10" align="center">
  <tr>
    <td><h2 align="center"><?=$name?></h2></td>
  </tr>
  <tr>
    <td>
      <div align="left">
        <?=$name?> is a member of the <?=$race?>. 
        <?=$HeShe?> has been trained as <?php echo getAdj($class); ?>. </div>
        <p align="left"><?=$wep?> <?=$arm?></p></td>
  </tr>
  <tr>
    <td><?=$descript = nl2br(getuser($peep,"description"));?></td>
  </tr>
</table>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.