SA-MP Forums Archive
OnPlayerCommandText - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerCommandText (/showthread.php?tid=143082)



OnPlayerCommandText - ||.Rier.|| - 21.04.2010

Well, I know this sounds like a damn n00bish asking for a line to fix.

I made this command:
Code:
public OnPlayerCommandText(playerid, cmdtext[])
 {
   if(strcmp(cmdtext, "/marinecorps") == 0)
	 {
		SetPlayerSkin(playerid, 287);
    GivePlayerWeapon(playerid,WEAPON_M4,850);
    SendClientMessage(playerid, COLOR_GREEN, "You are now on-duty as Soldier.");
    return 1;
    }
    return 0;
  }
And, I wanted to add another function just like that. But becoming a terrorist or cop or some.

Code:
{
   if(strcmp(cmdtext, "/terrorist") == 0)
	 {
		SetPlayerSkin(playerid, 142;
    GivePlayerWeapon(playerid,WEAPON_AK,850);
    SendClientMessage(playerid, COLOR_GREEN, "You are becomes a Terrorist.");
    return 1;
    }
    return 0;
  }
Maybe some others. But after I place it on the new line after the end of "}". It says invalid functions and such after I press Compile.

Can someone help me?

I know it's a damn noob question. But I really dont understand about this thing.

I already try by myself to fix the problem. But it doesn't do anything.

Thanks,
||.Rier.||


Re: OnPlayerCommandText - Steven82 - 21.04.2010

Maybe try fixing all the first letters to match up with eachother, maybe its all the indentions you have.


Re: OnPlayerCommandText - ||.Rier.|| - 21.04.2010

I tried everything I could. Fixing indentions, such else.

Well, Thanks Anyway.

PS: Could you please send me the right one then?


Re: OnPlayerCommandText - whitedragon - 21.04.2010

wait you just add the cmd? when yes you haveto code like this:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/marinecorps") == 0)
    {
    SetPlayerSkin(playerid, 287);
    GivePlayerWeapon(playerid,WEAPON_M4,850);
    SendClientMessage(playerid, COLOR_GREEN, "You are now on-duty as Soldier.");
    return 1;
    }
    if(strcmp(cmdtext, "/terrorist") == 0)
    {
    SetPlayerSkin(playerid, 142);
    GivePlayerWeapon(playerid,WEAPON_AK,850);
    SendClientMessage(playerid, COLOR_GREEN, "You are becomes a Terrorist.");
    return 1;
    }
    return 0;
}



Re: OnPlayerCommandText - Steven82 - 21.04.2010

Quote:
Originally Posted by whitedragon
wait you just add the cmd? when yes you haveto code like this:
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/marinecorps") == 0)
    {
    SetPlayerSkin(playerid, 287);
    GivePlayerWeapon(playerid,WEAPON_M4,850);
    SendClientMessage(playerid, COLOR_GREEN, "You are now on-duty as Soldier.");
    return 1;
    }
    if(strcmp(cmdtext, "/terrorist") == 0)
    {
    SetPlayerSkin(playerid, 142);
    GivePlayerWeapon(playerid,WEAPON_AK,850);
    SendClientMessage(playerid, COLOR_GREEN, "You are becomes a Terrorist.");
    return 1;
    }
    return 0;
}
Damn you beat me but just to say i think you setplayerskin indention's are screwed up.


Re: OnPlayerCommandText - whitedragon - 21.04.2010

i try make it right but i have no idea how its happen that it have 1 extra space on front of it


Re: OnPlayerCommandText - Steven82 - 21.04.2010

hm...idk


Re: OnPlayerCommandText - ||.Rier.|| - 21.04.2010

Well, thanks for the fast answers to all of you. Especially to whitedragon.

Thank You Very Much.

PS: Those things solved, compiled, not tested xD

Will try to test it later