Private vehicle help!
#1

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(vehicleid == xXitsgodzillaXx)
    {
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(strcmp(pName,"xXitsgodzillaXx") == 0)
    {
    SendClientMessage(playerid,-1,"Welcome back to you're car xXitsgodzillaXx!");
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
    }
    else
    {
    SendClientMessage(playerid,-1,"This car belongs to xXitsgodzillaXx!");
    PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
    RemovePlayerFromVehicle(playerid);
    }
    }

    if(vehicleid == AnthonyCanRead)
    {
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    if(strcmp(pName,"AnthonyCanRead") == 0)
    {
    SendClientMessage(playerid,-1,"Welcome back to you're car AnthonyCanRead!");
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
    }
    else
    {
    SendClientMessage(playerid,-1,"This car belongs to AnthonyCanRead!");
    PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
    RemovePlayerFromVehicle(playerid);
    }
    }
        return 1;
}
Quote:

C:\Documents and Settings\Owner\Desktop\saserver\gamemodes\DDPDRIFT .pwn(10723) : error 017: undefined symbol "vehicleid"
C:\Documents and Settings\Owner\Desktop\saserver\gamemodes\DDPDRIFT .pwn(10740) : error 017: undefined symbol "vehicleid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

I have the variables at the top yet im still getting these errors help please?
Reply
#2

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(vehicleid == xXitsgodzillaXx)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        if(strcmp(pName,"xXitsgodzillaXx") == 0)
        {
            SendClientMessage(playerid,-1,"Welcome back to you're car xXitsgodzillaXx!");
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        }
        else
        {
            SendClientMessage(playerid,-1,"This car belongs to xXitsgodzillaXx!");
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            RemovePlayerFromVehicle(playerid);
        }
    }
   
    if(vehicleid == AnthonyCanRead)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,sizeof(pName));
        if(strcmp(pName,"AnthonyCanRead") == 0)
        {
            SendClientMessage(playerid,-1,"Welcome back to you're car AnthonyCanRead!");
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
        }
        else
        {
            SendClientMessage(playerid,-1,"This car belongs to AnthonyCanRead!");
            PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
            RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
It's because it cannot find the variable named 'vehicleid', so we will create it when their state changes, and set it equal to the vehicle they have entered. I know you have them at the top, though this may work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)