GetPlayerName
#1

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;

Reply
#2

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;

Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)