SA-MP Forums Archive
GetPlayerName - 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: GetPlayerName (/showthread.php?tid=630928)



GetPlayerName - Immortal99 - 20.03.2017

I am trying to make a command which gives players a weapon set /giveweaponset [ID], now i want to make when i give someone a weapon set it should show, You gave %s[The ID] a weapon set and by the other person it should show, %s[Me] has gave u a weapon set.

Here is my CMD:

PHP код:
CMD:giveweaponset(playeridparams[])
{
    new 
gwsid;
    if(
sscanf(params"u"gwsid))
    {
        
SendClientMessage(playeridCOLOR_WHITE"[{FF0000}USAGE{FFFFFF}]: {FFCC00}/giveweaponset [PlayerID]{FFFFFF}");
        return 
1;
    }
    
GivePlayerWeapon(gwsid2760000);
    
GivePlayerWeapon(gwsid2460000);
    
GivePlayerWeapon(gwsid3160000);
    return 
1;




Re: GetPlayerName - Mic_H - 20.03.2017

PHP код:
stock PName(playerid)
{
    new 
name[24];
    
GetPlayerName(playeridname24);
    return 
name;
}
CMD:giveweaponset(playeridparams[])
{
    new 
gwsid;
    if(
sscanf(params"u"gwsid))
    {
        
SendClientMessage(playeridCOLOR_WHITE"[{FF0000}USAGE{FFFFFF}]: {FFCC00}/giveweaponset [PlayerID]{FFFFFF}");
        return 
1;
    }
    if(
gwsid == INVALID_PLAYER_ID || !IsPlayerConnected(gwsid))
        return 
SendClientMessage(playeridCOLOR_WHITE"Invalid PlayerName/PlayerID");
    
GivePlayerWeapon(gwsid2760000);
    
GivePlayerWeapon(gwsid2460000);
    
GivePlayerWeapon(gwsid3160000);
    new 
msg[80];
    
format(msgsizeof(msg), "You have given %s(%i) a weaponset."PName(gwsid), gwsid);
    
SendClientMessage(playeridCOLOR_WHITE /*COLOR*/msg);
    
format(msgsizeof(msg), "%s(%i) has given you a weaponset."PName(playerid), playerid);
    
SendClientMessage(gwsidCOLOR_WHITE /*COLOR*/msg);
    return 
1;




Re: GetPlayerName - Immortal99 - 20.03.2017

Quote:
Originally Posted by Mic_H
Посмотреть сообщение
PHP код:
stock PName(playerid)
{
    new 
name[24];
    
GetPlayerName(playeridname24);
    return 
name;
}
CMD:giveweaponset(playeridparams[])
{
    new 
gwsid;
    if(
sscanf(params"u"gwsid))
    {
        
SendClientMessage(playeridCOLOR_WHITE"[{FF0000}USAGE{FFFFFF}]: {FFCC00}/giveweaponset [PlayerID]{FFFFFF}");
        return 
1;
    }
    if(
gwsid == INVALID_PLAYER_ID || !IsPlayerConnected(gwsid))
        return 
SendClientMessage(playeridCOLOR_WHITE"Invalid PlayerName/PlayerID");
    
GivePlayerWeapon(gwsid2760000);
    
GivePlayerWeapon(gwsid2460000);
    
GivePlayerWeapon(gwsid3160000);
    new 
msg[80];
    
format(msgsizeof(msg), "You have given %s(%i) a weaponset."PName(gwsid), gwsid);
    
SendClientMessage(playeridCOLOR_WHITE /*COLOR*/msg);
    
format(msgsizeof(msg), "%s(%i) has given you a weaponset."PName(playerid), playerid);
    
SendClientMessage(gwsidCOLOR_WHITE /*COLOR*/msg);
    return 
1;

Thanks dude, appreciate it