/myskin command - 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: /myskin command (
/showthread.php?tid=328021)
/myskin command -
Aloushi - 23.03.2012
PHP код:
#include <sscanf2>
Код:
if(!strcmp(cmdtext, "/skin", true))
{
new
skin;
if( sscanf( params, "i", skin ) ) return SendClientMessage( playerid, -1, "Usage: /skin <ID>" );
if( skin > 299 || skin < 1 ) return SendClientMessage( playerid, -1, "Invalid ID. Available Skin IDs are 1 to 299!" );
new
string[ 128 ];
format( string, sizeof( string ), "You have changed your skin to %d", skin );
SendClientMessage( playerid, -1, string );
SetPlayerSkin( playerid, skin );
return 1;
}
the eroore is
PHP код:
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19652) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Re: /myskin command -
Alexy_Dramon - 23.03.2012
add on the top of your pawn
new params;
Re: /myskin command -
BrandyPenguin - 23.03.2012
What command processor you use?
you need to maybe change:
pawn Код:
new
skin;
if( sscanf( params, "i", skin ) ) return SendClientMessage( playerid, -1, "Usage: /skin <ID>" );
to:
pawn Код:
new
skin, command;
if( sscanf( cmdtext, "s[5]i", command,skin ) ) return SendClientMessage( playerid, -1, "Usage: /skin <ID>" );
You will never need to use command variable, but you don't have on OnPlayerCommandText params by default.
Re: /myskin command -
Aloushi - 23.03.2012
new params;
get error
PHP код:
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19652) : error 035: argument type mismatch (argument 1)
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19650) : warning 203: symbol is never used: "params"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Re: /myskin command -
antonio112 - 23.03.2012
pawn Код:
if(!strcmp(cmdtext, "/skin", true))
{
new skin;
if(sscanf(cmdtext, "i", skin)) return SendClientMessage( playerid, -1, "Usage: /skin <ID>" );
if( skin > 299 || skin < 1 ) return SendClientMessage( playerid, -1, "Invalid ID. Available Skin IDs are 1 to 299!" );
new string[50];
format( string, sizeof( string ), "You have changed your skin to %d", skin );
SendClientMessage( playerid, -1, string );
SetPlayerSkin( playerid, skin );
return 1;
}
Re: /myskin command -
Aloushi - 23.03.2012
Thanks alot +rep
Re: /myskin command -
Aloushi - 23.03.2012
soryy but not work when i type /skin 29 or skin 0 not work its get unknown command why !!
Re: /myskin command -
DarkB0y - 23.03.2012
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[128], string[128], cmd[128], idx, skinid;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/changeskin", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR, "Usage: /changeskin [skinid]");
skinid = strval(tmp);
if(IsValidSkin(skinid) == 0) return SendClientMessage(playerid, COLOR, "Error: invalid skin ID!");
SetPlayerSkin(playerid, skinid);
format(string, sizeof(string), "You have successfully changed your skin to %d", skinid);
SendClientMessage(playerid, COLOR, string);
return 1;
}
return 0;
}
try this
Re: /myskin command -
Aloushi - 23.03.2012
get 5 error
PHP код:
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19647) : error 017: undefined symbol "strtok"
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19647) : error 033: array must be indexed (variable "cmd")
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19650) : error 017: undefined symbol "strtok"
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19650) : error 033: array must be indexed (variable "tmp")
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19653) : error 017: undefined symbol "IsValidSkin"
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19662) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Abed\Desktop\stunt 0.3d\gamemodes\Faour.pwn(19646) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.
Re: /myskin command -
sDAAw - 23.03.2012
Would be just easier to use zcmd.