/set [sex] [male/female] Help please...
#11

Quote:
Originally Posted by dice7
pawn Код:
dcmd_set(playerid,params[])
{
  new pName[MAX_PLAYER_NAME], File[256],thing[3],value[6]; /*thing has 3, because "sex" has 3 chars, value has 6 becase "female" has 6 chars, "male has 4*/
    GetPlayerName(playerid,pName,sizeof(pName));
  format(File,sizeof(File),"CLRP/Players/%s.ini",pName);

  if(sscanf(params,"ss",thing,value)) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /set [sex] [male/female] :.");

  if(!strcmp(thing, "sex")) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /set [sex]

      if(!strcmp(value, "
male"))
      {
          dini_IntSet(File,"
Sex",1);
          PlayerInfo[playerid][pSex] = 1;
            SendClientMessage(playerid,COLOR_GREENLIGHT,"
.: Info: Gender set to Male :.");
      }

      else if(!strcmp(value, "
female")
      {
          dini_IntSet(File,"
Sex",2);
          PlayerInfo[playerid][pSex] = 2;
            SendClientMessage(playerid,COLOR_GREENLIGHT,"
.: Info: Gender set to Female :.");
      }
      else SendClientMessage(playerid,COLOR_GREY,"
.: Usage: /set [sex] [male/female] :.");

    return 1;
}
edited
Thanks man =)

The only thing that is wrong now is:

if I type "/set" it says: "/set [sex]" with is good
but if I type "/set sex" it says: /set [sex] witch is not good...

I want it to say "/set [sex] [male/female] when I type: "/set sex" and "/set [sex]" when I type "/set" :P

How to fix? xD
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)