respawn command
#1

I'm having few errors with this command that I tried to make, It's a respawn command that is suppose to respawn to the random places I've added

Код:
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(290) : warning 219: local variable "RandomSpawns" shadows a variable at a preceding level
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(292) : error 012: invalid function call, not a valid address
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(294) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
CMD:respawn(playerid, params[])
{
   new RandomSpawns[30],Float:health;
   GetPlayerHealth(playerid,health);
   if(health( < 90)
   {
        SpawnPlayer(playerid, RandomSpawns);
        SendClientMessage(playerid, -1, "{EFB509}(INFO) You have respawned!");
   }
   else
   {
      SendClientMessage(playerid, -1, "{FF0000}(INFO) You need atleast 90HP inorder to respawn yourself");
   }
   return 1;
}
Код:
new Float:RandomSpawns[][] =
{

   {2568.6689, 2833.4341,10.8203,292.7794},
   {2138.3416, -1759.2725,13.5528,352.4312},
   {2177.9382, -1743.7020,13.5469,300.3744},
   {2225.7798, -1644.8199,15.4876,69.4395},
   {2206.4468, -1507.7661,23.9938,262.146},
   {2121.0962, -1494.5468,23.9778,84.6788},
   {2000.4286, -1454.6078,13.5547,75.322},
   {1913.7010, -1411.6569,13.5703,54.7517},
   {1876.6216, -1394.1912,13.5703,71.2376},
   {1822.2927, -1470.1804,13.5498,122.1805},
   {1747.5808, -1477.9181,13.4716,92.2534},
   {1576.7819, -1447.4084,13.5391,43.8354},
   {1580.9941, -1330.7101,16.4844,356.0115},
   {1528.7294, -1280.0685,15.5230,90.3968},
   {1517.7842, -1206.1442,23.5938,188.5536},
   {1490.0099, -1152.9960,24.0781,101.9815},
   {1461.5786, -1170.2766,23.8197,65.0739},
   {1363.8411, -1131.8044,23.8281,187.4556},
   {1334.9390, -1156.7809,23.8281,263.7213},
   {1336.2676, -1234.9498,13.5469,271.8157},
   {1365.1504, -1307.6737,13.5469,136.2899},
   {1331.9596, -1387.7960,13.6414,265.3391},
   {1333.2629, -1418.3939,13.5450,278.4833},
   {1367.3390, -1413.7842,13.5554,10.0467},
   {1291.4662, -1523.4542,13.5625,170.3755},
   {1284.6349, -1563.9005,13.5391,180.9948},
   {1220.8425, -1656.7791,11.7969,272.4681},
   {1290.1395, -1786.3252,13.5469,261.2548},
   {1319.4794, -1844.6595,13.5469,82.0637}

};
Reply
#2

https://sampwiki.blast.hk/wiki/Random
Reply
#3

When you spawn the player obviously OnPlayerSpawn is called, you don't need random spawns in your command.
Reply
#4

I removed it now I have this left

Код:
C:\Users\yan\Desktop\SA-MP Server\gamemodes\DBv1.pwn(292) : error 012: invalid function call, not a valid address
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
   if(health( < 90)
Reply
#5

Код:
Try this

CMD:respawn(playerid)
{
   new Float:health;
   GetPlayerHealth(playerid,health);
   if(health( < 90)
   {
        SpawnPlayer(playerid);
        SendClientMessage(playerid, -1, "{EFB509}(INFO) You have respawned!");
   }
   else
   {
      SendClientMessage(playerid, -1, "{FF0000}(INFO) You need atleast 90HP inorder to respawn yourself");
   }
   return 1;
}
Reply
#6

Same error.
Reply
#7

Код:
if(health( < 90) <- Remove the red bracket
Reply
#8

Thanks it worked out @Daveosss.
Reply
#9

Код:
CMD:respawn(playerid)
{
   new Float:health;
   GetPlayerHealth(playerid,health);
   if(health < 90)
   {
        SpawnPlayer(playerid);
        SendClientMessage(playerid, -1, "{EFB509}(INFO) You have respawned!");
   }
   else
   {
      SendClientMessage(playerid, -1, "{FF0000}(INFO) You need atleast 90HP inorder to respawn yourself");
   }
   return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)