/Setspawn Problem - 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: /Setspawn Problem (
/showthread.php?tid=405927)
/Setspawn Problem -
Akcent_Voltaj - 08.01.2013
i do /setspawn 3 and doesent work.. /setspawn 3 is 2 ../setspawn 3 sends me to /setspawn 2..
PHP код:
if(strcmp(cmd, "/setspawn", true) == 0) //////BUGGGGGGGG - CONTINU!
{
if(IsPlayerConnected(playerid))
{
new x_nr[256];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) {
SendClientMessage(playerid, COLOR_RED, "|__________________ Alege Spawn ___________|");
SendClientMessage(playerid, COLOR_RED, "/setspawn [1,2,3]");
SendClientMessage(playerid, COLOR_RED, "SetSpawn (1) - Acasa");
SendClientMessage(playerid, COLOR_RED, "SetSpawn (2) - Spawn Civil");
SendClientMessage(playerid, COLOR_RED, "SetSpawn (3) - Factiune");
SendClientMessage(playerid, COLOR_RED, "|____________________________________________ |");
return 1;
}
if(Spectate[playerid] != 255 && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are Spectating, can't change the Spawn right now !");
return 1;
}
if(strcmp(x_nr,"1",true) == 0)
{
if(PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_RED, "Nu ai Casa");
return 1;
}
SendClientMessage(playerid, COLOR_RED, "Te vei respawna la casa ta,sau la chirie !");
SpawnChange[playerid] = 1;
OnPlayerUpdateEx(playerid);
return 1;
}
else if(strcmp(x_nr,"2",true) == 0)
{
SendClientMessage(playerid, COLOR_RED, "Te vei respawna la spawn civil !");
SpawnChange2[playerid] = 1;
OnPlayerUpdateEx(playerid);
return 1;
}
else if(strcmp(x_nr,"3",true) == 0)
{
if(PlayerInfo[playerid][pMember] != 0 || PlayerInfo[playerid][pLeader] != 0)
{
SendClientMessage(playerid, COLOR_RED, "Te vei respawna la factiunea ta !");
SpawnChange[playerid] = 0;
OnPlayerUpdateEx(playerid);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "Nu esti in nicio factiune !");
}
}
else
{
{
SendClientMessage(playerid, COLOR_GREY, " Nu ai casa / Dute si cumparati o casa !");
return 1;
}
}
return 1;
}
PHP код:
if(house !=255)
{
if(SpawnChange[playerid]) //If 1, then you get to your house, else spawn somewhere else
{
SetPlayerToTeamColor(playerid);
SetPlayerInterior(playerid,HouseInfo[house][hInt]);
SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
PlayerInfo[playerid][pLocal] = house;
PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
return 1;
}
}
if(SpawnChange2[playerid])
{
SetPlayerToTeamColor(playerid);
rand = random(sizeof(gRandomPlayerSpawns));
SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
return 1;
}
Re: /Setspawn Problem -
Akcent_Voltaj - 08.01.2013
anyone help?
Re: /Setspawn Problem -
dr.lozer - 08.01.2013
use sscanf by ******.. search for the plugin and inc coz sscanf is fast!
pawn Код:
if(strcmp(cmd, "/setspawn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new x_nr[256];
new id;
x_nr = strtok(cmdtext, idx);
if(sscanf(x_nr,"d",id)) {
SendClientMessage(playerid, COLOR_RED, "|__________________ Alege Spawn ___________|");
SendClientMessage(playerid, COLOR_RED, "/setspawn [1,2,3]");
SendClientMessage(playerid, COLOR_RED, "SetSpawn (1) - Acasa");
SendClientMessage(playerid, COLOR_RED, "SetSpawn (2) - Spawn Civil");
SendClientMessage(playerid, COLOR_RED, "SetSpawn (3) - Factiune");
SendClientMessage(playerid, COLOR_RED, "|____________________________________________ |");
return 1;
}
if(Spectate[playerid] != 255 && PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are Spectating, can't change the Spawn right now !");
return 1;
}
switch(id) {
case 1:
{
if(PlayerInfo[playerid][pPhousekey] == 255)
{
SendClientMessage(playerid, COLOR_RED, "Nu ai Casa");
return 1;
}
SendClientMessage(playerid, COLOR_RED, "Te vei respawna la casa ta,sau la chirie !");
SpawnChange[playerid] = 1;
OnPlayerUpdateEx(playerid);
return 1;
}
case 2:
{
SendClientMessage(playerid, COLOR_RED, "Te vei respawna la spawn civil !");
SpawnChange2[playerid] = 1;
OnPlayerUpdateEx(playerid);
return 1;
}
case 3:
{
if(PlayerInfo[playerid][pMember] != 0 || PlayerInfo[playerid][pLeader] != 0)
{
SendClientMessage(playerid, COLOR_RED, "Te vei respawna la factiunea ta !");
SpawnChange[playerid] = 0;
OnPlayerUpdateEx(playerid);
return 1;
} else return SendClientMessage(playerid, COLOR_RED, "Nu esti in nicio factiune !");
}
}
return 1;
}
and please next time use [ pawn ] code [ /pawn ]