19.12.2010, 15:55
Hello, i made a enum to save the players weapons for the next time they join, and i used this:
But it seems to dont work, because the positions, skins, and teams work, but you spawn without guns, whats the problem with the code? Thanks you and happy chrismas
pawn Код:
new rweaponid, rammo;
new sweaponid2, sammo2;
new zweaponid3, zammo3;
enum pInfo
{
pWeapon1,
pWeapon2,
pWeapon3,
pAmmo1,
pAmmo2,
pAmmo3,
pModel,
pSkin,
Float: pPos_x,
Float: pPos_y,
Float: pPos_z,
Float: pPos_r,
pInt,
};
public OnPlayerSpawn(playerid)
{
switch(gClass[playerid])
{
case 0:
{
SetPlayerColor(playerid, 0x004080FF);
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:angle;
GetPlayerFacingAngle(playerid, angle);
new skin = GetPlayerSkin(playerid);
new Int = GetPlayerInterior(playerid);
GetPlayerWeaponData(playerid, 1, rweaponid, rammo);
PlayerInfo[playerid][pWeapon1] = rweaponid;
PlayerInfo[playerid][pAmmo1] = rammo;
GetPlayerWeaponData(playerid, 2, sweaponid2, sammo2);
PlayerInfo[playerid][pWeapon2] = sweaponid2;
PlayerInfo[playerid][pAmmo2] = sammo2;
GetPlayerWeaponData(playerid, 3, zweaponid3, zammo3);
PlayerInfo[playerid][pWeapon3] = zweaponid3;
PlayerInfo[playerid][pAmmo3] = zammo3;
PlayerInfo[playerid][pSkin] = skin;
PlayerInfo[playerid][pModel] = 0;
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;
PlayerInfo[playerid][pPos_r] = angle;
PlayerInfo[playerid][pInt] = Int;
return 1;
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new team = PlayerInfo[playerid][pModel];
new Float: Xpos = PlayerInfo[playerid][pPos_x];
new Float: Ypos = PlayerInfo[playerid][pPos_y];
new Float: Zpos = PlayerInfo[playerid][pPos_z];
new Float: Rpos = PlayerInfo[playerid][pPos_r];
new skin = PlayerInfo[playerid][pSkin];
new wep1 = PlayerInfo[playerid][pWeapon1];
new wep2 = PlayerInfo[playerid][pWeapon2];
new wep3 = PlayerInfo[playerid][pWeapon3];
new ammo1 = PlayerInfo[playerid][pAmmo1];
new ammo2 = PlayerInfo[playerid][pAmmo2];
new ammo3 = PlayerInfo[playerid][pAmmo3];
new Int = PlayerInfo[playerid][pInt];
if (strcmp(cmd, "/login", true) ==0 )
{
if(IsPlayerConnected(playerid))
{
new tmppass[64];
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, grey, " You are already logged in.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, grey, " USAGE: /login [password]");
return 1;
}
strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
String(tmppass);
OnPlayerLogin(playerid,tmppass);
SetSpawnInfo(playerid, team, skin, Xpos, Ypos, Zpos, Rpos, wep1, ammo1, wep2, ammo2, wep3, ammo3);
SetPlayerInterior(playerid, Int);
SpawnPlayer(playerid);
}
return 1;
}
return 0;
}