SetPlayrClass(playerid, classid) help? -
BigAl - 24.09.2011
Hello and i was just wondering if anyone knows how to fix my problem. my problem is when i type /buyclothes it and then select the class I want, it doesn't set the class it just keeps it as cj, but i want it to change to a specific class.. how?
pawn Код:
#include <a_samp>
#include <zcmd>
new spawn[MAX_PLAYERS];
new classselection[MAX_PLAYERS];
public OnGameModeInit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
spawn[playerid] = 1;
SetSpawnInfo(playerid, 0, 0, -1514.9274,2525.9253,55.7668, 12.5629, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnPlayerRequestClass(playerid)
{
if(spawn[playerid] == 1)
{
SpawnPlayer(playerid);
}
if(classselection[playerid] == 1)
{
SetPlayerPos(playerid,2480.3538,1870.8656,24.3753);
SetPlayerCameraPos(playerid,2473.7202,1870.9253,25.7971);
SetPlayerCameraLookAt(playerid,2480.3538,1870.8656,24.3753);
SetPlayerFacingAngle(playerid,86.9258);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(classselection[playerid] == 1)
{
GivePlayerMoney(playerid, -1000);
}
classselection[playerid] = 0;
return 1;
}
CMD:buyclothes(playerid, params[])
{
if(classselection[playerid] == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Clothes", "Hobo", "Okay", "");
SetSpawnInfo(playerid, 0, 0, -1514.9274,2525.9253,55.7668, 12.5629, 0, 0, 0, 0, 0, 0);
classselection[playerid] = 1;
}
else
{
SendClientMessage(playerid, -1, "You are already in the clothes shop!");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case 1:
{
if(response)
{
SendClientMessage(playerid, -1, "You have changed your clothes!");
SpawnPlayer(playerid);
return 1;
}
switch(listitem)
{
case 0:
{
SetPlayerSkin(playerid, 1);
}
}
}
}
return 1;
}
Re: SetPlayrClass(playerid, classid) help? -
Backwardsman97 - 24.09.2011
Why not just change their skin?
Re: SetPlayrClass(playerid, classid) help? -
N.K.Stallone - 24.09.2011
I see your mistake you did SetSpawnInfo(playerid, 0, 0, -1514.9274,2525.9253,55.7668, 12.5629, 0, 0, 0, 0, 0, 0);
You specified the spawn skin as 0 the 0 is the cj skin.I think this is the problem.You need to make that whenever you buyclothes you sapwn with the clothes you selected.
Re: SetPlayrClass(playerid, classid) help? -
CmZxC - 24.09.2011
nvm this, look at bgtrackers post.
Re: SetPlayrClass(playerid, classid) help? -
N.K.Stallone - 24.09.2011
Quote:
Originally Posted by Backwardsman97
Why not just change their skin?
|
This is not an answer and i don't think he understands what you mean and i didn't too. If you mean someone to report for skin change that is lame even if we talk for a roleplay server and i am 100% sure he is making this for roleplay server. Else i don't understand for what are you talking abut.
Re: SetPlayrClass(playerid, classid) help? -
Kaperstone - 24.09.2011
pawn Код:
#include <a_samp>
#include <zcmd>
new spawn[MAX_PLAYERS];
new classselection[MAX_PLAYERS];
public OnGameModeInit()
{
//AddPlayerClass(skin, Float:x, Float:y, Float:z, Float:Angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);
//ADD CLASS HERE!!
return 1;
}
public OnPlayerConnect(playerid)
{
spawn[playerid] = 1; // if player should spawn
//SpawnPlayer(playerid);
return 1;
}
public OnPlayerRequestClass(playerid)
{
if(spawn[playerid] == 1) {
SpawnPlayer(playerid);
// useless... -.- when player switch skin/class this will work , than you should put it under on player connect
} // if player : spawn = 0 than it will do this:
else {
if(classselection[playerid] == 1) {
SetPlayerPos(playerid,2480.3538,1870.8656,24.3753);
SetPlayerCameraPos(playerid,2473.7202,1870.9253,25.7971);
SetPlayerCameraLookAt(playerid,2480.3538,1870.8656,24.3753);
SetPlayerFacingAngle(playerid,86.9258);
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(classselection[playerid] == 1) {
GivePlayerMoney(playerid, -1000);
SetSpawnInfo(playerid, 0, 0, -1514.9274,2525.9253,55.7668, 12.5629, 0, 0, 0, 0, 0, 0);
classselection[playerid] = 0; // u need to set this 0 if you dont want that every time he spawn he will get -1,000$
} // if player classselection = 0 than :
else {
classselection[playerid] = 0;
SetSpawnInfo(playerid, 0, 0, -1514.9274,2525.9253,55.7668, 12.5629, 0, 0, 0, 0, 0, 0);
}
return 1;
}
CMD:buyclothes(playerid, params[])
{
if(classselection[playerid] == 0) {
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Clothes", "Hobo", "Okay", "");
SetSpawnInfo(playerid, 0, 0, -1514.9274,2525.9253,55.7668, 12.5629, 0, 0, 0, 0, 0, 0);
classselection[playerid] = 1;
}
else {
SendClientMessage(playerid, -1, "You are already in the clothes shop!");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid) {
case 1:
{
if(response) {
SendClientMessage(playerid, -1, "You have changed your clothes!");
SpawnPlayer(playerid); // y did you put SpawnPlayer here? you dont need to spawn player to change his skin
return 1;
}
switch(listitem) {
case 0:
{
SetPlayerSkin(playerid, 1);
}
}
}
}
return 1;
}