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



name problem - SHE790 - 07.07.2014

Hi all when i use the cmds it dont show who did to who

this is the freeze cmd "Admin %s has frozen %s|Reason: %s"

ScreenShot: http://8pic.ir/images/is3qs6z40d9spky8g89u.png


it dont show the names please help


Re: name problem - cnoopers - 07.07.2014

show cmd code


Re: name problem - SHE790 - 07.07.2014

this is freeze code
Quote:

CMD:freeze(playerid, params[])
{
if(pInfo[playerid][Adminlevel]< 1) return SCM(playerid, Red, "You're not authorized to use this command");
new
targetid,reason[48],string[128];
if(sscanf(params, "us[48]", targetid,reason)) return SCM(playerid,-1,"USAGE: /freeze [playerid] [reason]");
TogglePlayerControllable(targetid, false);
pInfo[targetid][Freeze] = 1;
format(string,sizeof(string),"Admin %s has frozen %s|Reason: %s",GN(playerid),GN(targetid),reason);
SCMToAll(Red,string);
return 1;
}




Re: name problem - KayJ - 07.07.2014

Quote:
Originally Posted by SHE790
Посмотреть сообщение
this is freeze code
Only freeze code?


Re: name problem - SHE790 - 07.07.2014

Quote:
Originally Posted by SturtIndia
Посмотреть сообщение
Only freeze code?
No all the cmds :/
Quote:
Originally Posted by ******
Посмотреть сообщение
You don't check if the target is connected.
can u give me a example please?


Re: name problem - Brezon - 07.07.2014

Do
if(!sscanf(params, "us[48]", targetid,reason)) return SCM(playerid,-1,"USAGE: /freeze [playerid] [reason]");
Please tell me if I am wrong not so good with it.

pawn Код:
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ERROR: Wrong player ID");
if(targetid == playerid) return SendClientMessage(playerid,-1,"ERROR: You cant freeze yourself!");
new tname[MAX_PLAYER_NAME];
GetPlayerName(targetid,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
I hope this helped


Re: name problem - KayJ - 07.07.2014

Quote:
Originally Posted by Brezon
Посмотреть сообщение
Do
if(!sscanf(params, "us[48]", targetid,reason)) return SCM(playerid,-1,"USAGE: /freeze [playerid] [reason]");
Please tell me if I am wrong not so good with it.
it should be like this:
pawn Код:
if(!sscanf(params, "us[48]", targetid,reason)) return SCM(playerid,-1,"USAGE: /freeze [playerid] [reason]");
Please use [ PAWN ] [ /PAWN ] before typing any pawno code


Re: name problem - SHE790 - 07.07.2014

Quote:
Originally Posted by Brezon
Посмотреть сообщение
Do
if(!sscanf(params, "us[48]", targetid,reason)) return SCM(playerid,-1,"USAGE: /freeze [playerid] [reason]");
Please tell me if I am wrong not so good with it.

pawn Код:
if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ERROR: Wrong player ID");
if(Target == playerid) return SendClientMessage(playerid,-1,"ERROR: You cant freeze yourself!");
new tname[MAX_PLAYER_NAME];
GetPlayerName(Target,tname,sizeof(tname));
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
I hope this helped
no it didnt


Re: name problem - SHE790 - 07.07.2014

Still it dont show the names


Re: name problem - Rittik - 07.07.2014

Код:
CMD:freeze(playerid, params[])
{
if(pInfo[playerid][Adminlevel]< 1) return SCM(playerid, Red, "You're not authorized to use this command");
new targetid,reason[48];
if(sscanf(params, "us[48]", targetid,reason))
{
SCM(playerid,-1,"USAGE: /freeze [playerid] [reason]");
return 1;
}
else
{
if(IsPlayerConnected(targetid) && targetid != INVALID_PLAYER_ID)
{
new string[128],name1[MAX_PLAYER_NAME+1],name2[MAX_PLAYER_NAME+1];
TogglePlayerControllable(targetid, false);
pInfo[targetid][Freeze] = 1;
GetPlayerName(playerid,name1,sizeof(name1));
GetPlayerName(targetid,name2,sizeof(name2));
format(string,sizeof(string),"Admin %s has frozen %s|Reason: %s",name1,name2,reason);
SCMToAll(Red,string);
}
else
{
SCM(playerid, Red, "Player is not connected/valid");
return 1;
}
}
return 1;
}