SA-MP Forums Archive
[HELP] Little Script - 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: [HELP] Little Script (/showthread.php?tid=512463)



[HELP] Little Script - monster010 - 10.05.2014

Код:
C:\gf.pwn(5325) : warning 219: local variable "PlayerName" shadows a variable at a preceding levelver used: "PlayerName1"
pawn Код:
if(newcar == punanicar)
    {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        if(strcmp(PlayerName, "PuNaNi", true) == 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "This is your car, PuNaNi");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx, cy, cz);
            SendClientMessage(playerid, COLOR_GREY, "This car is owned to scripter PuNaNi");
        }
    }



Re: [HELP] Little Script - KillerStrike23 - 10.05.2014

new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
try this! you might using another playername
pawn Код:
if(newcar == punanicar)    
{
    new playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);        
    if(strcmp(playername, "PuNaNi", true) == 0)        
    {
        SendClientMessage(playerid, COLOR_GREY, "This is your car, PuNaNi");        
    }        
    else        
    {
        RemovePlayerFromVehicle(playerid);            
        new Float:cx, Float:cy, Float:cz;            
        GetPlayerPos(playerid, cx, cy, cz);            
        SetPlayerPos(playerid, cx, cy, cz);            
        SendClientMessage(playerid, COLOR_GREY, "This car is owned to scripter PuNaNi");        
    }    
}