help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help (
/showthread.php?tid=128463)
help -
aircombat - 17.02.2010
Код:
dcmd_givevip(playerid,params[]) {
new string1024[256], tmp[256], tmp2[256];
if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /givevip [playerid]");
new playername[MAX_PLAYER_NAME];
#pragma unused params
new player1 = strval(tmp);
if(PlayerInfo[playerid][Level] >= 5) {
SetPlayerRank(playerid,1);
format(string1024,sizeof(string1024),"You have made %s A V.I.P", playername);
SendClientMessage(playerid,blue,string1024);
if(player1 != playerid)
{
SendClientMessage(playerid, red, "You Are Now V.I.P");
}
}
return 1;
}
how to do this the right way , when i type /givevip it says : /givevip playerid , and if i typed by example /givevip 0 , it also say /givevip playerid , also how to make it if player is not connected , it say so

________
Love Discussion
Re: help -
Miguel - 17.02.2010
I suggest you to use sscanf:
pawn Код:
dcmd_givevip(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid, red, "You're not allowed to use this command!");
new
id,
string[128];
if(sscanf(params, "u", id)) return SendClientMessage(playerid, red, "USAGE: /givevip [playerid]");
else if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red, "That player is not connected to the server!");
// else if(GetPlayerRank(params) == 1) return SendClientMessage(playerid, red, "That player is a V.I.P already!");
else
{
new
pName[MAX_PLAYER_NAME];
SetPlayerRank(id, 1);
GetPlayerName(id, pName, sizeof(pName));
format(string, sizeof(string), "You've made %s a V.I.P!", pName);
SendClientMessage(playerid, blue, string);
format(string, sizeof(string), "You're now a V.I.P!");
SendClientMessage(id, red, string);
}
return 1;
}
Or:
pawn Код:
dcmd_givevip(playerid, params[])
{
if(PlayerInfo[playerid][Level] < 5) return SendClientMessage(playerid, red, "You're not allowed to use this command!");
new
string[128];
else if(strlen(params) < 1) return SendClientMessage(playerid, red, "USAGE: /givevip [playerid]");
else if(!IsPlayerConnected(params)) return SendClientMessage(playerid, red, "That player is not connected to the server!");
// else if(GetPlayerRank(id) == 1) return SendClientMessage(playerid, red, "That player is a V.I.P already!");
else
{
new
pName[MAX_PLAYER_NAME];
SetPlayerRank(params, 1);
GetPlayerName(params, pName, sizeof(pName));
format(string, sizeof(string), "You've made %s a V.I.P!", pName);
SendClientMessage(playerid, blue, string);
format(string, sizeof(string), "You're now a V.I.P!");
SendClientMessage(params, red, string);
}
return 1;
}
Re: help -
aircombat - 18.02.2010
thnx 4 the help dude , it worked

________
Weed Vaporizers