SA-MP Forums Archive
Fireduty script - 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: Fireduty script (/showthread.php?tid=126270)



Fireduty script - too803 - 07.02.2010

I made this script

if(strcmp(cmd, "/fireduty", true) == 0) {
SendClientMessage(playerid, COLOR_RED1, "You are now a Firefighter");
SendClientMessage(playerid, COLOR_RED1, "You have no command at this time");
gTeam[playerid] = TEAM_FIRE;
SetPlayerColor(playerid, COLOR_RED);
SetPlayerPos(playerid, 1776.2158,2080.5100,10.8203);
GivePlayerWeapon(playerid, 9, 1);
GivePlayerWeapon(playerid, 42, 500);
SetPlayerSkin(playerid, 27;
return 1;
}


and when i go ingame to test it shows the SEVER:UNKNOWNCOMMAND


Re: Fireduty script - LuxurioN™ - 07.02.2010

In command, all seems correct. Show your OnPlayerCommandText

Or, try this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/fireduty", true) == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "You are now a Firefighter");
SendClientMessage(playerid, COLOR_YELLOW, "You have no command at this time");
gTeam[playerid] = TEAM_FIRE;
SetPlayerColor(playerid, COLOR_RED);
SetPlayerPos(playerid, 1776.2158,2080.5100,10.8203);
GivePlayerWeapon(playerid, 9, 1);
GivePlayerWeapon(playerid, 42, 500);
SetPlayerSkin(playerid, 278);
return 1;
}
return 0;
}



Re: Fireduty script - Calgon - 07.02.2010

Try this:

pawn Код:
if(strcmp(cmdtext, "/fireduty", true) == 0) {



Re: Fireduty script - too803 - 07.02.2010

I am forgeting the onplayercommandtext,what would i add in that area?



Re: Fireduty script - bajskorv123 - 07.02.2010

Theres no need to use strtok if you dont have any other commands.
By the way are you returning 0 at bottom?
Try this:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/fireduty", cmdtext, true)==0)
  {
    SendClientMessage(playerid, COLOR_YELLOW, "You are now a Firefighter");
    SendClientMessage(playerid, COLOR_YELLOW, "You have no command at this time");
    gTeam[playerid] = TEAM_FIRE;
    SetPlayerColor(playerid, COLOR_RED);
    SetPlayerPos(playerid, 1776.2158, 2080.5100, 10.8203);
    GivePlayerWeapon(playerid, 9, 1);
    GivePlayerWeapon(playerid, 42, 500);
    SetPlayerSkin(playerid, 278);
    return 1;
  }
  return 0;
}



Re: Fireduty script - too803 - 07.02.2010

Hannes,thats what I did wrong,i put mine in the wrong place and I liked yours better,Thanks


Re: Fireduty script - bajskorv123 - 07.02.2010

No problem