vehicle help - 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: vehicle help (
/showthread.php?tid=246889)
vehicle help -
fissekarl - 06.04.2011
Hello, I have a problem with this.
pawn Код:
COMMAND:vgoto(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=1) {
new vid;
if(sscanf(params, "d", vid)) return SendClientMessage(playerid, Yellow, "Usage: /gotov <vehicleid>");
new Float:x, Float:y, Float:z, vw;
GetVehiclePos(vid,x,y,z);
vw = GetVehicleVirtualWorld(vid);
SetPlayerVirtualWorld(playerid,vw);
if(GetPlayerState(playerid) == 2)
{
new pvid = GetPlayerVehicleID(playerid);
SetVehiclePos(pvid,x,y,z);
SetVehicleVirtualWorld(pvid,vw);
}
else SetPlayerPos(playerid,x,y,z+1);
} else if(PlayerInfo[playerid][pAdminLevel] == 0) return 0;
return 1;
}
Can anyone show how to make a code where you cant goto a vehicle which doesnt exists?
Re: vehicle help -
Hornet600 - 06.04.2011
pawn Код:
if(vid = INVALID_VEHICLE_ID)
{
return 1;
}
Re: vehicle help -
fissekarl - 06.04.2011
I added that
pawn Код:
if(vid = INVALID_VEHICLE_ID) return SendClientMessage(playerid, Red, "This vehicle doesn't exist");
Then it gives this error
pawn Код:
warning 211: possibly unintended assignment
So I changed it to
!= didnt work, also I tried == didnt work either, so how?
Re: vehicle help -
RoboN1X - 06.04.2011
try
pawn Код:
new vehid = strval(vid);
if(vehid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, Red, "This vehicle doesn't exist");
Re: vehicle help -
fissekarl - 06.04.2011
argument type mismatch (argument 1)?
Re: vehicle help -
RoboN1X - 06.04.2011
change vid to params
Re: vehicle help -
fissekarl - 06.04.2011
Not working ingame
Re: vehicle help -
Hitman-97- - 06.04.2011
Quote:
Originally Posted by Robo_N1X
try
pawn Код:
new vehid = strval(vid); if(vehid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, Red, "This vehicle doesn't exist");
|
Robo correction is correct, check again
Re: vehicle help -
fissekarl - 06.04.2011
It doesn't work :S
Re: vehicle help -
RoboN1X - 06.04.2011
hmmm... try:
pawn Код:
new vid = strval(params);
if(vid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, Red, "This vehicle doesn't exist");