Fireduty script
#1

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

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

Try this:

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

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

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

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

No problem
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)