PDA

View Full Version : string help (not sure if it's possible) D:


Marco_Valentine
25/11/2011, 08:17 PM
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.
format(string, sizeof(string), "%d",gLastCar[killerid]);
if(PlayerInfo[i][pCarKeys] == string)

I need to know what this line should be? D:
if(PlayerInfo[i][pCarKeys] == string

Sascha
25/11/2011, 08:27 PM
if(PlayerInfo[i][pCarKeys] == gLastCar[killerid])


senseless to format an integer into a string if you just need the integer itself:D

Marco_Valentine
25/11/2011, 08:38 PM
i love you

Rob_Maate
25/11/2011, 08:41 PM
1. hi marco
2. try something like this


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

Marco_Valentine
25/11/2011, 08:44 PM
Rob it's 8 am, /goto bed :P.

And thanks :) I already used Sascha's code

Rob_Maate
25/11/2011, 08:46 PM
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk kkkkkkkkkkkkkkkkkkkkkkkk
and no i woke up like 20 mins ago - work omg