SA-MP Forums Archive
What is wrong here +rep - 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)
+--- Thread: What is wrong here +rep (/showthread.php?tid=334983)



What is wrong here +rep - Faisal_khan - 16.04.2012

Hi SA-MP Community,

What the hell is wrong with this goddamn code!
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_YES)
    {
        if(GetVehicleModel(vehicleid) == 597)
        {
            new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
            GetVehiclePos(vehicleid, plocx, plocy, plocz);
            CreateSpike(plocx,plocy,plocz,ploca);
        }
        else
        {
            return 0;
        }
    }
    return 1;
}
}
I get errors:
pawn Код:
error 017: undefined symbol "vehicleid"
error 017: undefined symbol "vehicleid"
Here:
pawn Код:
if(GetVehicleModel(vehicleid) == 597)
And Here:
pawn Код:
GetVehiclePos(vehicleid, plocx, plocy, plocz);



Re: What is wrong here +rep - Hoss - 16.04.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_YES)
    {
        vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);    
        if(GetVehicleModel(vehicleid) == 597)
        {
//these lines are secret
        }
        else
        {
            return 0;
        }
    }
    return 1;
}



Re: What is wrong here +rep - Faisal_khan - 16.04.2012

It Must be:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys == KEY_YES)
    {
        new vehicleid; // u missed new here
        vehicleid = GetPlayerVehicleID(playerid);    
        if(GetVehicleModel(vehicleid) == 597)
        {
//these lines are secret
        }
        else
        {
            return 0;
        }
    }
    return 1;
}
Thank you its working +rep.