[FilterScript] Skin Changer
#1

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;
}
Reply
#2

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
Reply
#3

Oh I forgot something! Sry, my bad! Updated now!
Reply
#4

Good command for the beginning!
Reply
#5

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!
Reply
#6

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

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!
Reply
#8

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;
}

Reply
#9

Omg, just try!
Reply
#10

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 } ._.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)