SA-MP Forums Archive
help plz with error "OnPlayerCommandText" should return a value error - 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: help plz with error "OnPlayerCommandText" should return a value error (/showthread.php?tid=67368)



help plz with error "OnPlayerCommandText" should return a value error - alex011 - 01.03.2009

:\Users\lamis\Desktop\servers\myserver\filterscrip ts\ball.pwn(131) : warning 209: function "OnPlayerCommandText" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.



public OnPlayerCommandText(playerid, cmdtext[])

if(strcmp(cmdtext, "/Nrgball", true) == 0){

if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 522){
SendClientMessage(playerid, COLOR_RED, "Welcome to the ball");
SetVehiclePos(GetPlayerVehicleID(playerid), -1299.1689,-98.2901,14.9644);
SetVehicleZAngle(GetPlayerVehicleID(playerid), 3.872666);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0);

}
return 1;
}


Re: help plz with error "OnPlayerCommandText" should return a value error - Towlies - 01.03.2009

I suggest you learn some basics of scripting.....Read this following Wiki page.

https://sampwiki.blast.hk/wiki/Scripting_Basics


Re: help plz with error "OnPlayerCommandText" should return a value error - tehcudguy - 01.03.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/Nrgball", true) == 0)
    {
      if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 522){
      SendClientMessage(playerid, COLOR_RED, "Welcome to the ball");
      SetVehiclePos(GetPlayerVehicleID(playerid), -1299.1689,-98.2901,14.9644);
      SetVehicleZAngle(GetPlayerVehicleID(playerid), 3.872666);
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
      }
      return 1;
    }
    return 0;
}



Re: help plz with error "OnPlayerCommandText" should return a value error - Rks25 - 01.03.2009

Fear, please mind the indentation!
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/Nrgball", true) == 0)
  {
   
    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 522)
    {
      SendClientMessage(playerid, COLOR_RED, "Welcome to the ball");
      SetVehiclePos(GetPlayerVehicleID(playerid), -1299.1689,-98.2901,14.9644);
      SetVehicleZAngle(GetPlayerVehicleID(playerid), 3.872666);
      LinkVehicleToInterior(GetPlayerVehicleID(playerid), 0);
    }
    return 1;
  }
  return 0;
}
This looks better(easier to read) and avoids chance of not working thanks to blurred indentation.