31.08.2011, 22:42
Thanks, its a lot better than the code I was just using. Now I seem to be having a problem with the Owner variable.
I want it to say this when you enter a vehicle.
If the vehicle is owned by you it should say "INFO: Welcome to your vehicle 'Name'."
And if the vehicle isn't owned by you it should say "INFO: This vehicle is owned by 'Name'."
But unfortunately it does say that but its all wrong, here's my fail code:
And heres my variable for vOwner.
I want it to say this when you enter a vehicle.
If the vehicle is owned by you it should say "INFO: Welcome to your vehicle 'Name'."
And if the vehicle isn't owned by you it should say "INFO: This vehicle is owned by 'Name'."
But unfortunately it does say that but its all wrong, here's my fail code:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new file[128], str[128], name[MAX_PLAYER_NAME];
new vehicleid = GetPlayerVehicleID(playerid);
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "/Vehicles/%d.ini", vehicleid);
format(name, sizeof(name), "%s", dini_Get(file, "Owner"));
foreach(Player, i)
{
if(PlayerInfo[i][pCarKey] == vehicleid)
{
format(str, sizeof(str), "INFO: This vehicle is owned by %s.", name);
}
else if(PlayerInfo[i][pCarKey] != vehicleid)
{
format(str, sizeof(str), "INFO: Welcome to your vehicle %s.", name);
}
SendClientMessage(playerid, COLOR_YELLOW, str);
}
}
return 1;
}
pawn Код:
vOwner[MAX_PLAYER_NAME]