/Setspawn Problem
#1

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(cmdtextidx);
                    if(!
strlen(x_nr)) {
                    
SendClientMessage(playeridCOLOR_RED"|__________________ Alege Spawn ___________|");
                    
SendClientMessage(playeridCOLOR_RED"/setspawn [1,2,3]");
                    
SendClientMessage(playeridCOLOR_RED"SetSpawn (1) - Acasa");
                    
SendClientMessage(playeridCOLOR_RED"SetSpawn (2) - Spawn Civil");
                    
SendClientMessage(playeridCOLOR_RED"SetSpawn (3) - Factiune");
                    
SendClientMessage(playeridCOLOR_RED"|____________________________________________ |");
                    return 
1;
                    }
                    if(
Spectate[playerid] != 255 && PlayerInfo[playerid][pAdmin] < 1)
                    {
                    
SendClientMessage(playeridCOLOR_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(playeridCOLOR_RED"Nu ai Casa");
                        return 
1;
                    }
                    
SendClientMessage(playeridCOLOR_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(playeridCOLOR_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] != || PlayerInfo[playerid][pLeader] != 0)
                    {
                        
SendClientMessage(playeridCOLOR_RED"Te vei respawna la factiunea ta !");
                        
SpawnChange[playerid] = 0;
                        
OnPlayerUpdateEx(playerid);
                        return 
1;
                    }
                    else return 
SendClientMessage(playeridCOLOR_RED"Nu esti in nicio factiune !");
                    }
                     }
                      else
                    {
                    {
                    
SendClientMessage(playeridCOLOR_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(playeridHouseInfo[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(playeridgRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
                        
return 1;
                    } 
Reply
#2

anyone help?
Reply
#3

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 ]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)