SA-MP Forums Archive
[FilterScript] Skin Changer - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Skin Changer (/showthread.php?tid=257161)



Skin Changer - fiki574 - 24.05.2011

Hi! So I created this very simple skin changer script! Just type /skin (skinID) if you want to change your skin!

Код:
#include <a_samp>
#include <core>
#include <float>
#include "../include/gl_common.inc"
#define orange 			0xFF9900AA
Код:
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/skin", true) == 0)
{
          new tmp[256];
	  tmp = strtok(cmdtext,idx);
	  SetPlayerSkin(playerid,strval(tmp));
	  new string[256], pname[MAX_PLAYER_NAME];
	  GetPlayerName(playerid, pname, sizeof(pname));
	  format(string, sizeof(string), "%s commanded Change Skin (/skin ID)", pname);
  	  SendClientMessageToAll(orange, string);
	  return 1;
}



Re: Skin Changer - Phanto90 - 24.05.2011

Quote:

if(strcmp(cmd, "/skin", true) == 0)
new tmp[256];
tmp = strtok(cmdtext,idx);
SetPlayerSkin(playerid,strval(tmp));
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s commanded Change Skin (/skin ID)", pname);
SendClientMessageToAll(orange, string);
return 1;
}

Is this a FS? Better to post it in useful function.
Note:
-strtok is not always used by all and it's not even defined in your script, but it's not the worst problem.
-cmd is not defined (should be the first strtok)
-there is no { at the start of the command. How is that supposed to work D: ?

Looks like you copied and pasted a part of a gamemode


Re: Skin Changer - fiki574 - 24.05.2011

Oh I forgot something! Sry, my bad! Updated now!


Re: Skin Changer - Seven_of_Nine - 24.05.2011

Good command for the beginning!


Re: Skin Changer - fiki574 - 24.05.2011

Quote:
Originally Posted by Phanto90
Посмотреть сообщение
Is this a FS? Better to post it in useful function.
Note:
-strtok is not always used by all and it's not even defined in your script, but it's not the worst problem.
-cmd is not defined (should be the first strtok)
-there is no { at the start of the command. How is that supposed to work D: ?

Looks like you copied and pasted a part of a gamemode
Yep from part of MY gamemode!


Re: Skin Changer - Phanto90 - 24.05.2011

Forgot the initial {
And better include strtok, the part of the include has no use


Re: Skin Changer - fiki574 - 24.05.2011

Quote:
Originally Posted by Phanto90
Посмотреть сообщение
Forgot the initial {
And better include strtok, the part of the include has no use
I dont need initial {
You tried to compile? If you didnt, try and you will see u dont get any errors!


Re: Skin Changer - Phanto90 - 24.05.2011

Quote:
Originally Posted by fiki574_CRO
Посмотреть сообщение
I dont need initial {
You tried to compile? If you didnt, try and you will see u dont get any errors!
This is nonsense, study pawn.. if you get no error it does not make your code right. It is LOGICAL incorrect.
So if you type the command
Quote:
if(strcmp(cmd, "/skin", true) == 0)
new tmp[256];
//This is what happen b y typing the command
tmp = strtok(cmdtext,idx); //This is a consequence that has nothing to do with the command
SetPlayerSkin(playerid,strval(tmp));
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s commanded Change Skin (/skin ID)", pname);
SendClientMessageToAll(orange, string);

return 1;
}




Re: Skin Changer - fiki574 - 24.05.2011

Omg, just try!


Re: Skin Changer - Phanto90 - 24.05.2011

Omg ._. Do you actually understand the meaning of { & }? Don't think so. Any other middle-expert scripter would say the same thing i said.

So if you don't need { you can also remove the final } ._.