OnPlayerConnect skin selector
#1

Hi,
I am getting some problems regarding skin selector.I hope i will get this problem fixed.I explained my problem as below

1.I searched for many OnPlayerConnect skin selector but didn't find anything.The script i use have only 1 character as default(i edit default bare.pwn in which i can select only 1 skin) .If you can share that kind of script in which i can take any of 299 skins when a player connects than it would be very helpful.
Example: https://imgur.com/a/5BTdVvy

2.When i use the command /skin [id] my skin is changed for an instant but when i die or respawn it return back to my default one,which i was having before.Check this video : https://*********/DE5u2OzKKxY

I want something like which can save the default skin which a player selected using /skin or selected at OnPlayerConnect,which do not change untill the player type /skin

My pawno Code : https://pastebin.com/rbwgptb7

Regards,
Marquess
Reply
#2

you do not need so many commands, you can use sscanf and another order processor.

and in order not to erase the skin you have to save it in the mysql, ini, dini database ..
Reply
#3

First of all, do not use #pragma tabsize 0 and indent your code properly. It's an extremely bad practise and makes your code un-readable. It's a mistake I used to do when I was first starting out as well. Second of all, you don't need a command for each type of skin. You can just use SSCANF. Here is a link to it;
https://sampforum.blast.hk/showthread.php?tid=570927

The command will look something like this;
pawn Код:
CMD:skin(playerid, params[]) {
new skinid;
if(sscanf(params,"d",skinid)) return SendClientMessage(playerid, -1, "Usage: /skin <ID>");
else {
if(skinid >= 0 && skinid <= 311) {
 SetPlayerSkin(playerid,skinid);
}
}
return 1;
}
Do NOT use this code as it is poorly indented(it doesnt even have any) as I am on phone. Write your own code. What this does is basically it requires the user to input a skinid, which it saves in "skinid" variable, it then checks if the skinid is equal to or greater than 0 and equal to or lesser than 311 which are default samp skin id max/mins. If it is true, the system changes the player's skin to the specified ID.
You could also create a variable called playerSkin to store the player's skin like this;

new playerSkin[MAX_PLAYERS];

This will create an array of playerSkin with the size of MAX_PLAYERS. You can then change the player's skin to playerSkin under OnPlayerSpawn. Like this;

SetPlayerSkin(playerid, playerSkin[playerid]);

Please ****** what an array is before using this. Don't dorget to initiliaze the array element before using it as well, otherwise you'll get 0 every time you spawn(CJ skin)

In order to save your skin values, you need a saving system. I personally recommend learning MySQL, but feel free to experment with any of them.
Reply
#4

Thanks for help,i will try more on it or may discuss via pm
Reply
#5

Quote:
Originally Posted by MarquX
Посмотреть сообщение
Thanks for help,i will try more on it or may discuss via pm
Try not to use PM and discuss it publicly in order to help people who suffer from a similar issue.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)