08.07.2011, 16:30
Hello, when players TP from a DM zone, they loose their weapons, but when they leave the server in DM zone, they spawn next time with them. What is the code to disarm players when they join?
enum WEP_DAT
{
e_iWeapons[13],
e_iAmmo[13],
};
new gPlayerWeaponData[MAX_PLAYERS][WEP_DAT];
RemoveWeapons(playerid)
{
for(new i; i < 13; i++)
GetPlayerWeaponData(playerid, i, gPlayerWeaponData[playerid][e_iWeapons][i], gPlayerWeaponData[playerid][e_iAmmo][i]);
ResetPlayerWeapons(playerid);//this function disarms players
}
GiveBackWeapons(playerid)
{
for(new i; i < 13; i++)
GivePlayerWeapon(playerid, gPlayerWeaponData[playerid][e_iWeapons][i], gPlayerWeaponData[playerid][e_iAmmo][i]);
}
public OnPlayerConnect(playerid)
{
new string[128];
format(string, sizeof(string), "~r~Welcome to Xtreme Stunts!~n~~n~Please start with reading the /rules");
GameTextForPlayer(playerid, string, 10000, 4);
SetPlayerColor(playerid, PlayerColors[playerid]);
IsInDM[playerid] = 0;
AutoRepairUsed[playerid] = 0;
AutoRepairTrigger[playerid] = 0;
SendClientMessage(playerid, 0x99FFFFAA, "This server has auto repair/flip");
SendClientMessage(playerid, 0x99FFFFAA, "Welcome! Hope you enjoy your stay!");
nojump2[playerid] = 0;
TextDrawShowForPlayer(playerid, Textdraw1);
ReceiveInfo[playerid] = true;
if(IsVoteKickStarted == true)
{
TextDrawShowForPlayer(playerid, Background); //Prevent bugs in case a player connect while a votekick is started
TextDrawShowForPlayer(playerid, VoteKickTitle);
TextDrawShowForPlayer(playerid, VoteKickName);
TextDrawShowForPlayer(playerid, VoteKickVote);
TextDrawShowForPlayer(playerid, VoteKickTime);
return 1;
}
return 1;
}
Wrote a couple of functions for you, the names should be enough to tell you what they do.
pawn Код:
|
// Deathmatch Command
ResetWeapons( playerid );
// GivePlayerWeapon, blablablabla
// Leave Deathmatch Command
ResetPlayerWeapons( playerid );
GiveBackWeapons( playerid );