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=157346)



OnPlayerCommandText - yoan103 - 06.07.2010

hi, well i have this script

public OnPlayerCommandText(playerid, cmdtext[])
{
if (!strcmp("/repair", cmdtext))
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
return 1;
}
}

and i get this warning


C:\Documents and Settings\Oni\My Documents\Downloads\samp03asvr_R8_win32\gamemodes\ Awesome.pwn(6 : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.


line 68 is this

} (this is the last one)

can you help me, (also can i make it dcmd, i really need it)


Re: OnPlayerCommandText - CAR - 06.07.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
   if (!strcmp("/repair", cmdtext))
   {
      if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
      RepairVehicle(GetPlayerVehicleID(playerid));
      SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
      return 1;
   }
   return 0;
}



Re: OnPlayerCommandText - yoan103 - 06.07.2010

Thank you


Re: OnPlayerCommandText - ViruZZzZ_ChiLLL - 06.07.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
 if (!strcmp("/repair", cmdtext))
 {
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You are not in a vehicle!");
  RepairVehicle(GetPlayerVehicleID(playerid));
  SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle has been successfully repaired!");
  return 1;
  }
return 0;
}
Always return a 0 on OnPlayerCommandText

EDIT : Sorry, didn't know it was quick reply D: