13.06.2010, 16:08
Hy!
I have tried to create something with function GetPlayerID, but doesnt works
Here is the function
And here is the code:
If i do this with name Bart it wrotes: "You have wheelclamped Bart's car", it sets to my dini PlayerVehicleIsAtMechanicHQ to 1,but it doesn't sends me the message: "to your car has been set a wheelclamped"
Please help me
I have tried to create something with function GetPlayerID, but doesnt works
Here is the function
Код:
stock GetPlayerID(gstring[])
{
for(new i = 0; i <= GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i) == 1)
{
new testname[MAX_PLAYER_NAME];
GetPlayerName(i, testname, sizeof(testname));
if(strcmp(testname, gstring, true, strlen(gstring)) == 0)
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}
Код:
vehInfo[vehid][IsAtMechanicHQ]=1;
format(string,128,"You have set a wheelclamped to %s's car.",vehInfo[vehid][vownername]);
SendClientMessage(playerid,COLOR_GREEN,string);
dUserSetINT(vehInfo[vehid][vownername]).("PlayerVehicleIsAtMechanicHQ",1);
new aplayerid = GetPlayerID(vehInfo[vehid][vownername]);
if(aplayerid > INVALID_PLAYER_ID)
{
SendClientMessage(aplayerid,COLOR_RED, "To your car has been set a wheelclamped!");
VehicleInfo[aplayerid][PlayerVehicleIsAtMechanicHQ]=1;
}
Please help me

