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(playerid, params[])
{
new gwsid;
if(sscanf(params, "u", gwsid))
{
SendClientMessage(playerid, COLOR_WHITE, "[{FF0000}USAGE{FFFFFF}]: {FFCC00}/giveweaponset [PlayerID]{FFFFFF}");
return 1;
}
GivePlayerWeapon(gwsid, 27, 60000);
GivePlayerWeapon(gwsid, 24, 60000);
GivePlayerWeapon(gwsid, 31, 60000);
return 1;
}
Re: GetPlayerName -
Mic_H - 20.03.2017
PHP код:
stock PName(playerid)
{
new name[24];
GetPlayerName(playerid, name, 24);
return name;
}
CMD:giveweaponset(playerid, params[])
{
new gwsid;
if(sscanf(params, "u", gwsid))
{
SendClientMessage(playerid, COLOR_WHITE, "[{FF0000}USAGE{FFFFFF}]: {FFCC00}/giveweaponset [PlayerID]{FFFFFF}");
return 1;
}
if(gwsid == INVALID_PLAYER_ID || !IsPlayerConnected(gwsid))
return SendClientMessage(playerid, COLOR_WHITE, "Invalid PlayerName/PlayerID");
GivePlayerWeapon(gwsid, 27, 60000);
GivePlayerWeapon(gwsid, 24, 60000);
GivePlayerWeapon(gwsid, 31, 60000);
new msg[80];
format(msg, sizeof(msg), "You have given %s(%i) a weaponset.", PName(gwsid), gwsid);
SendClientMessage(playerid, COLOR_WHITE /*COLOR*/, msg);
format(msg, sizeof(msg), "%s(%i) has given you a weaponset.", PName(playerid), playerid);
SendClientMessage(gwsid, COLOR_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(playerid, name, 24);
return name;
}
CMD:giveweaponset(playerid, params[])
{
new gwsid;
if(sscanf(params, "u", gwsid))
{
SendClientMessage(playerid, COLOR_WHITE, "[{FF0000}USAGE{FFFFFF}]: {FFCC00}/giveweaponset [PlayerID]{FFFFFF}");
return 1;
}
if(gwsid == INVALID_PLAYER_ID || !IsPlayerConnected(gwsid))
return SendClientMessage(playerid, COLOR_WHITE, "Invalid PlayerName/PlayerID");
GivePlayerWeapon(gwsid, 27, 60000);
GivePlayerWeapon(gwsid, 24, 60000);
GivePlayerWeapon(gwsid, 31, 60000);
new msg[80];
format(msg, sizeof(msg), "You have given %s(%i) a weaponset.", PName(gwsid), gwsid);
SendClientMessage(playerid, COLOR_WHITE /*COLOR*/, msg);
format(msg, sizeof(msg), "%s(%i) has given you a weaponset.", PName(playerid), playerid);
SendClientMessage(gwsid, COLOR_WHITE /*COLOR*/, msg);
return 1;
}
|
Thanks dude, appreciate it