SA-MP Forums Archive
string help (not sure if it's possible) D: - 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: string help (not sure if it's possible) D: (/showthread.php?tid=299409)



string help (not sure if it's possible) D: - Marco_Valentine - 25.11.2011

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    if(CarSystem[vehicleid][cPerma] == 1)
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        new string[128];
        format(string, sizeof(string), "%d",gLastCar[killerid]);
        if(PlayerInfo[i][pCarKeys] == string)
        PlayerInfo[i][pCarKeys] == 9999;
        DeleteCar(vehicleid);
        }
        return 1;
    }

When the vehicle is destroyed. I want the string to find what player online has the car keys (player owned vehicle) of the car destroyed.

That is how i am trying to check throughout the server who has the vehicle keys.
pawn Код:
format(string, sizeof(string), "%d",gLastCar[killerid]);
if(PlayerInfo[i][pCarKeys] == string)
I need to know what this line should be? D:
pawn Код:
if(PlayerInfo[i][pCarKeys] == string



Re: string help (not sure if it's possible) D: - Sascha - 25.11.2011

pawn Код:
if(PlayerInfo[i][pCarKeys] == gLastCar[killerid])
senseless to format an integer into a string if you just need the integer itself


Re: string help (not sure if it's possible) D: - Marco_Valentine - 25.11.2011

i love you


Re: string help (not sure if it's possible) D: - Rob_Maate - 25.11.2011

1. hi marco
2. try something like this

pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
 if(PlayerInfo[i][pCarKeys] == vehicleid)
 {
  PlayerInfo[i][pCarKeys] = 999;
 }
}
remember that the killerid of a vehicle may not necessarily be the one driving it


Re: string help (not sure if it's possible) D: - Marco_Valentine - 25.11.2011

Rob it's 8 am, /goto bed :P.

And thanks I already used Sascha's code


Re: string help (not sure if it's possible) D: - Rob_Maate - 25.11.2011

kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkk
and no i woke up like 20 mins ago - work omg