Posts: 15
Threads: 5
Joined: Oct 2018
Reputation:
0
How the players get the auto weapons
At spawn players
Can you help me with a service to give the players weapons?
for example :
cmd:weaponset
with save weapons
Posts: 357
Threads: 6
Joined: Feb 2018
Random Weapons on Spawn
pawn Code:
new RandomWeapons[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
RandomWeapons[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
GivePlayerSpawnWeapons(playerid);
return 1;
}
stock GivePlayerSpawnWeapons(playerid)
{
switch(RandomWeapons[playerid])
{
case 0:
{
// Random Weapons 1
RandomWeapons[playerid]++; // Increases the RandomWeapon value to 1,
}
case 1:
{
// Random Weapons 2
RandomWeapons[playerid] = 0; // Reset to Value 0 , so it will give Random Weapon 1 weapons again when player spawns.
}
}
}
Posts: 357
Threads: 6
Joined: Feb 2018
Quote:
Originally Posted by TheToretto
The fuck? Firstly there is no absolute "GivePlayerWeapon" native in your code, from where do you want to get the weapon? Then, weapons IDs are limited between 1 and 46, and thirdly I don't understand a shit in your switch statement, sorry :/
|
I just gave him the outline of the code.
here is it.
pawn Code:
stock GivePlayerSpawnWeapons(playerid)
{
switch(RandomWeapons[playerid])
{
case 0:
{
// Random Weapons 1
GivePlayerWeapon(playerid, 31, 500); // M4
GivePlayerWeapon(playerid, 24, 400); // Deagle
RandomWeapons[playerid]++; // Increases the RandomWeapon value to 1,
}
case 1:
{
// Random Weapons 2
GivePlayerWeapon(playerid, 32, 800); // TEC-9
GivePlayerWeapon(playerid, 26, 20); // SawnOff
RandomWeapons[playerid] = 0; // Reset to Value 0 , so it will give Random Weapon 1 weapons again when player spawns.
}
}
}
Atleast let him learn something instead of giving him the whole code and he will just copy and paste it.