is this code right?
#1

hi im making a command is this code right or wrong? im getting a error

Код:
stock OldSkin(targetid)
{
OldSkin == GetPlayerSkin(targetid)
}
Код:
CMD:trolladutyoff(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:You are not rcon admin");
new targetid,str[75];
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:Usage(playerid/name)");
SetPlayerSkin(targetid,OldSkin); // error line!
SetPlayerColor(playerid,-1);
format(str,sizeof(str),"~G~Admin Duty Disabled.");
GameTextForPlayer(targetid,str,3000,3);
return 1;
}
error:- (113) : error 076: syntax error in the expression, or invalid function call
Reply
#2

You must put oldskin on sscanf

EDIT:

I can't really understand what you want to do
Reply
#3

why you are creating stock for it you can make a variable for that example

pawn Код:
new OldSkin;//At top of script
then

at on duty command

pawn Код:
OldSkin = GetPlayerSkin(playerid);
then at off duty command

pawn Код:
SetPlayerSkin(playerid, OldSkin);
Reply
#4

Change the error line to:

Код:
SetPlayerSkin(targetid, OldSkin(targetid));
Check it and tell me again!
Reply
#5

for save:
PHP код:
oldskin[playerid] = GetPlayerSkin(playerid); 
for use:
PHP код:
CMD:trolladutyoff(playerid,params[])
{
if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:You are not rcon admin");
new 
targetid,str[75];
if(
sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:Usage(playerid/name)");
SetPlayerSkin(targetid,oldskin[targetid]); // error line!
SetPlayerColor(playerid,-1);
format(str,sizeof(str),"~G~Admin Duty Disabled.");
GameTextForPlayer(targetid,str,3000,3);
return 
1;

on the top:
PHP код:
new oldskin[MAX_PLAYERS]; 
about the stock
http://forum.sa-mp.com/showthread.ph...ht=abuse+stock
Reply
#6

Quote:
Originally Posted by jlalt
Посмотреть сообщение
for save:
PHP код:
oldskin[playerid] = GetPlayerSkin(playerid); 
for use:
PHP код:
CMD:trolladutyoff(playerid,params[])
{
if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:You are not rcon admin");
new 
targetid,str[75];
if(
sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:Usage(playerid/name)");
SetPlayerSkin(targetid,oldskin[targetid]); // error line!
SetPlayerColor(playerid,-1);
format(str,sizeof(str),"~G~Admin Duty Disabled.");
GameTextForPlayer(targetid,str,3000,3);
return 
1;

on the top:
PHP код:
new oldskin[MAX_PLAYERS]; 
about the stock
http://forum.sa-mp.com/showthread.ph...ht=abuse+stock
no it didnt worked

it gets back to cj skin.
Reply
#7

Quote:
Originally Posted by ahameed4755
Посмотреть сообщение
no it didnt worked

it gets back to cj skin.
Set the old skin variable when the player goes on duty.
Reply
#8

if it still the same , [ cj skin ] try to change old
PHP код:
new oldskin[MAX_PLAYERS]; 
with
PHP код:
new Float:oldskin[MAX_PLAYERS]; 
Reply
#9

Quote:
Originally Posted by jlalt
Посмотреть сообщение
if it still the same , [ cj skin ] try to change old
PHP код:
new oldskin[MAX_PLAYERS]; 
with
PHP код:
new Float:oldskin[MAX_PLAYERS]; 
Why Float? That's totally wrong....

Here's a working one:

Top of script:

Код:
new DutyOldSkin[MAX_PLAYERS] = {-1, ...}; // Also used for determining if the player is on duty; you can change that
In a "/duty" command (which toggles duty on/off):

Код:
// Put Admin Level Check here
if(DutyOldSkin[playerid] == -1)
{
DutyOldSkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, 75); // 75 as example duty-skin
}
else
{
SetPlayerSkin(playerid, DutyOldSkin[playerid]);
DutyOldSkin[playerid] = -1;
}
OnPlayerDisconnect:

Код:
DutyOldSkin[playerid] = -1;
Reply
#10

Quote:
Originally Posted by NaS
Посмотреть сообщение
Why Float? That's totally wrong....

Here's a working one:

Top of script:

Код:
new DutyOldSkin[MAX_PLAYERS] = {-1, ...}; // Also used for determining if the player is on duty; you can change that
In a "/duty" command (which toggles duty on/off):

Код:
// Put Admin Level Check here
if(DutyOldSkin[playerid] == -1)
{
DutyOldSkin[playerid] = GetPlayerSkin(playerid);
SetPlayerSkin(playerid, 75); // 75 as example duty-skin
}
else
{
SetPlayerSkin(playerid, DutyOldSkin[playerid]);
DutyOldSkin[playerid] = -1;
}
OnPlayerDisconnect:

Код:
DutyOldSkin[playerid] = -1;
ok thanks. i will try!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)