OnPlayerCommandText
#1

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.||
Reply
#2

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

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

Well, Thanks Anyway.

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

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;
}
Reply
#5

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.
Reply
#6

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

hm...idk
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)