31.08.2016, 09:29
Hi, guys! Tried to recreate VWH (Don't worry, I won't publicly give it, or start a server unless I get Rudy's permission), but I got a bug when generating a wolf name. Here's the code for it.
That's what I can give for now, for I still need your replies on what information do you still need. The bug here is that when the player shapeshifts to a werewolf, it works alright. But, when the werewolf shapeshifts back to a human, the werewolf name stays, leaving the old name. Also, the player's skin will change to a skin of another online player. For example, his previous skin was a cop, but when he turns back to human, the previous cop skin won't come back, but his current skin is now another online player's skin.
PHP код:
if(!UsedAnimation[playerid])
{
new string[MAX_PLAYER_NAME+14];
if(PlayerInfo[playerid][pCall] > -1)
{
string[0] = PlayerInfo[playerid][pCall];
PlayerInfo[playerid][pCall] = -EXTERIOR;
PlayerInfo[string[0]][pCall] = -EXTERIOR;
if(GetPlayerSpecialAction(string[0]) == SPECIAL_ACTION_USECELLPHONE)
{
SetPlayerSpecialAction(string[0], SPECIAL_ACTION_STOPUSECELLPHONE);
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USECELLPHONE)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
}
}
format(string,sizeof(string),"UniqueIDs/ID_%06d.ini",PlayerInfo[playerid][pUniqueID]);
if(Skills[playerid][SniperRifle] == 255)
{
UsedAnimation[playerid] = true;
SetTimerEx("AnimationCoolDown", 1000, false, "i", playerid);
PlayerActionMessageBubble(playerid, "shapeshifts into the wolf form.");
Skills[playerid][SniperRifle] = 511;
SetPlayerSkin(playerid, 0);
ResetPlayerWeapons(playerid);
DOF2_GetStringEx(string, "Wnm", string, sizeof(string), "General");
SetPlayerName(playerid, string);
new Float:health = 1.0;
health = 50.0 + (5.0 * Skills[playerid][DesertEagle]);
new Float:healthex = 1.0;
GetPlayerHealth(playerid, healthex);
if(healthex > health)
{
SetPlayerHealth(playerid, health);
}
SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);
SetPlayerColor(playerid, COLOR_WEREWOLF);
TogglePlayerControllable(playerid, true);
for(new i; i < MAX_PLAYER_ATTACHED_ACCSSORIES+PlayerInfo[playerid][pDonator]+1; i++)
{
RemovePlayerAttachedObject(playerid, i);
}
}
else
{
PlayerActionMessageBubble(playerid, "shapeshifts into the human form.");
UsedAnimation[playerid] = true;
SetTimerEx("AnimationCoolDown", 1000, false, "i", playerid);
Skills[playerid][SniperRifle] = 255;
DOF2_GetStringEx(string,"Nme",string,sizeof(string),"General");//(file[],key[],result[],size,tag[]="");
SetPlayerName(playerid, string);
format(string,sizeof(string),"Accounts/%s.ini",string);
SetPlayerSkin(playerid, DOF2_GetInt(string,"Skn","General"));
SetPlayerFightingStyle(playerid, FIGHT_STYLE_GRABKICK);
SetPlayerColor(playerid, COLOR_NEUTRAL);
TogglePlayerControllable(playerid, true);
new bone, Float: OffsetX, Float: OffsetY, Float: OffsetZ, Float: RotX, Float: RotY, Float: RotZ, Float: ScaleX, Float: ScaleY, Float: ScaleZ;
format(string, sizeof(string), "UniqueIDs/ID_%06d.ini", PlayerInfo[playerid][pUniqueID]);
new slot[6];
for(new i; i < MAX_PLAYER_ATTACHED_ACCSSORIES+PlayerInfo[playerid][pDonator]+1; i++)
{
new key[3];
format(key, sizeof(key), "S%d", i+1);
slot[i] = DOF2_GetInt(string, key, "Attachments");
if(slot[i] != -255)
{
if(Inventory[playerid][slot[i]] < 0)
{
format(key, sizeof(key), "A%d", i+1);
new sstring[90];
DOF2_GetStringEx(string, key, sstring, sizeof(sstring), "Attachments");
sscanf(sstring, "ifffffffff",bone, OffsetX, OffsetY, OffsetZ, RotX, RotY, RotZ, ScaleX, ScaleY, ScaleZ);
SetPlayerAttachedObject(playerid, i+1, -Inventory[playerid][slot[i]]-9700000, bone, OffsetX, OffsetY, OffsetZ, RotX, RotY, RotZ, ScaleX, ScaleY, ScaleZ);
}
else
{
DOF2_SetInt(string, key, -255, "Attachments");
DOF2_SaveFile();
}
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You must wait between each action.");
}
}