PDA

View Full Version : invalid function call, not a valid address


rati555
08/01/2012, 06:47 PM
if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "** You aren't police {FF0000} Police!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}USAGE:{FF8000}/drag [playerid/PartOfName]");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
new playa;
playa = ReturnUser(tmp);
if(!IsPlayerInVehicle(playa(vehicleid)) // line 15213
{
SendClientMessage(playerid, COLOR_GRAD1, "** Target Must Be On Foot");
return 1;
}
if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar) || IsAHspdCar(newcar))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playa,x,y,z);
if(PlayerToPoint(5, playerid, x, y, z))
{
PutPlayerInVehicle(playa,newcar,1);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "** Player isn't near you !");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "** you are not in a Cop Vehicle !");
}
}
return 1;
}
(15231) : error 012: invalid function call, not a valid address
(15231) : error 017: undefined symbol "vehicleid"
(15231) : error 029: invalid expression, assumed zero
(15231) : fatal error 107: too many error messages on one line

Norck
08/01/2012, 06:56 PM
Try this:

if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "** You aren't police {FF0000} Police!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}USAGE:{FF8000}/drag [playerid/PartOfName]");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
new playa;
playa = ReturnUser(tmp);
if(IsPlayerInVehicle(playa)) // line 15213
{
SendClientMessage(playerid, COLOR_GRAD1, "** Target Must Be On Foot");
return 1;
}
if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar) || IsAHspdCar(newcar))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playa,x,y,z);
if(PlayerToPoint(5, playerid, x, y, z))
{
PutPlayerInVehicle(playa,newcar,1);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "** Player isn't near you !");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "** you are not in a Cop Vehicle !");
}
}
return 1;
}

rati555
08/01/2012, 07:03 PM
(15231) : warning 202: number of arguments does not match definition

Norck
08/01/2012, 07:11 PM
(15231) : warning 202: number of arguments does not match definition

My bad, it should be

IsPlayerInAnyVehicle

instead of

IsPlayerInVehicle

So the code will be:

if(strcmp(cmd, "/drag", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!IsACop(playerid))
{
SendClientMessage(playerid, COLOR_GRAD1, "** You aren't police {FF0000} Police!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{FF0000}USAGE:{FF8000}/drag [playerid/PartOfName]");
return 1;
}
new newcar = GetPlayerVehicleID(playerid);
new playa;
playa = ReturnUser(tmp);
if(IsPlayerInAnyVehicle(playa)) // line 15213
{
SendClientMessage(playerid, COLOR_GRAD1, "** Target Must Be On Foot");
return 1;
}
if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar) || IsAHspdCar(newcar))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playa,x,y,z);
if(PlayerToPoint(5, playerid, x, y, z))
{
PutPlayerInVehicle(playa,newcar,1);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s drags %s to his/her car/moped.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "** Player isn't near you !");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "** you are not in a Cop Vehicle !");
}
}
return 1;
}