SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 16/08/2009, 05:50 PM   #11
introzen
Gangsta
 
introzen's Avatar
 
Join Date: Aug 2008
Posts: 788
Reputation: 34
Default Re: /set [sex] [male/female] Help please...

Quote:
Originally Posted by dice7
pawn Code:
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
__________________
"No problem can be solved from the same level of consciousness that created it." - Albert Einstein
introzen is offline  
Old 16/08/2009, 05:53 PM   #12
Google63
Big Clucker
 
Join Date: Jun 2008
Posts: 113
Reputation: 0
Default Re: /set [sex] [male/female] Help please...

Man that is really easy to get if you look;

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

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

man just look a bit before posting; looking at code is a lot faster then posting
Google63 is offline  
Old 16/08/2009, 06:41 PM   #13
introzen
Gangsta
 
introzen's Avatar
 
Join Date: Aug 2008
Posts: 788
Reputation: 34
Default Re: /set [sex] [male/female] Help please...

Quote:
Originally Posted by JoeBullet
Man that is really easy to get if you look;

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

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

man just look a bit before posting; looking at code is a lot faster then posting
Still don't work...
__________________
"No problem can be solved from the same level of consciousness that created it." - Albert Einstein
introzen is offline  
Old 16/08/2009, 06:50 PM   #14
introzen
Gangsta
 
introzen's Avatar
 
Join Date: Aug 2008
Posts: 788
Reputation: 34
Default Re: /set [sex] [male/female] Help please...

I tried and tried with many thing and shit but finally I ended up like this:

pawn Code:
dcmd_set(playerid,params[])
{
  new pName[MAX_PLAYER_NAME], File[256],thing[3],value[6];
    GetPlayerName(playerid,pName,sizeof(pName));
  format(File,sizeof(File),"CLRP/Players/%s.ini",pName);
  if(params[0] == 0) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /set [sex] :.");
  if(sscanf(params,"ss",thing,value))
  if(strcmp(thing, "sex")) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /set [sex] :.");
    if(!strcmp(thing, "sex") && value[0] == 0) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /set [sex] [male/female] :.");
    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 if(strcmp(value, "female") || strcmp(value, "male")) return SendClientMessage(playerid,COLOR_GREY,".: Usage: /set [sex] [male/female] :.");
    return 1;
}

works exactly how I want it xD

Problem Solved, thanks
__________________
"No problem can be solved from the same level of consciousness that created it." - Albert Einstein
introzen is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hello i have problem with dialog male female and years mata014 Help Archive 0 07/07/2010 02:26 PM


All times are GMT. The time now is 09:51 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.