vehicle help
#1

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

pawn Код:
if(vid = INVALID_VEHICLE_ID)
{
return 1;
}
Reply
#3

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?
Reply
#4

try
pawn Код:
new vehid = strval(vid);
if(vehid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, Red, "This vehicle doesn't exist");
Reply
#5

argument type mismatch (argument 1)?
Reply
#6

change vid to params
Reply
#7

Not working ingame
Reply
#8

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

It doesn't work :S
Reply
#10

hmmm... try:
pawn Код:
new vid = strval(params);
if(vid == INVALID_VEHICLE_ID) return SendClientMessage(playerid, Red, "This vehicle doesn't exist");
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)