>> Get Player Name Help << [+REP]
#9

Quote:
Originally Posted by LivingLikeYouDo
Посмотреть сообщение
Dat string is useless. Why are you declaring 128 cells for a 50 cells string?
Also, why are you defining the result before the outcomes? Also, for getting name, you use MAX_PLAYER_NAME, which returns a value of 24.

This is better:

Код:
CMD:repair(playerid, params[])
{
    if(Job[playerid] != 7)
        return SendClientMessage(playerid, 0xAFAFAFAA, "You not are Mechanic");

    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "You are not in a vehicle!");

    new name[MAX_PLAYER_NAME + 2], string[50];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s repaired his vehicle.", name);
    SendClientMessageToAll(-1, string);
    return 1;
}
@osman2571 : That is the worst example, we are using a temporary new value, and getting name from playername requires opening of file, getting the name, formatting it, and closing the file, which results in slow time.
Thanks alot man
+REP
Reply


Messages In This Thread
>> Get Player Name Help << [+REP] - by DarknessKnight - 21.07.2014, 09:17
Re: >> Get Player Name Help << - by osman2571 - 21.07.2014, 09:24
Re: >> Get Player Name Help << [+REP] - by SPA - 21.07.2014, 09:41
Re: >> Get Player Name Help << [+REP] - by DarknessKnight - 21.07.2014, 09:55
Re: >> Get Player Name Help << [+REP] - by SPA - 21.07.2014, 09:57
Re: >> Get Player Name Help << [+REP] - by LivingLikeYouDo - 21.07.2014, 09:58
Re: >> Get Player Name Help << [+REP] - by osman2571 - 21.07.2014, 09:59
Re: >> Get Player Name Help << [+REP] - by SPA - 21.07.2014, 10:02
Re: >> Get Player Name Help << [+REP] - by DarknessKnight - 21.07.2014, 10:05
Re: >> Get Player Name Help << [+REP] - by LivingLikeYouDo - 21.07.2014, 10:12

Forum Jump:


Users browsing this thread: 1 Guest(s)