26.10.2013, 18:58
Hey, guys. I tried to convert the Gate system from zGaming to my MySQL gamemode and somehow everytime I use this command my server crashes:
pawn Код:
CMD:creategate(playerid, params[])
{
new string[128], object;
if(playerVariables[playerid][pAdminLevel] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "i", object)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /creategate [objectid]");
for(new idx=1; idx<MAX_GATES; idx++)
{
if(!gatesVariables[idx][gModel])
{
GetPlayerPos(playerid, gatesVariables[idx][gCX], gatesVariables[idx][gCY], gatesVariables[idx][gCZ]);
gatesVariables[idx][gModel] = object;
gatesVariables[idx][gCX] = gatesVariables[idx][gCX] + 2;
gatesVariables[idx][gCY] = gatesVariables[idx][gCY] + 2;
gatesVariables[idx][gCRX] = 0;
gatesVariables[idx][gCRY] = 0;
gatesVariables[idx][gCRZ] = 0;
GetPlayerPos(playerid, gatesVariables[idx][gOX], gatesVariables[idx][gOY], gatesVariables[idx][gOZ]);
gatesVariables[idx][gOX] = gatesVariables[idx][gOX] + 2;
gatesVariables[idx][gOY] = gatesVariables[idx][gOY] + 2;
gatesVariables[idx][gORX] = 0;
gatesVariables[idx][gORY] = 0;
gatesVariables[idx][gORZ] = 0;
gatesVariables[idx][gStatus] = 0;
format(gatesVariables[idx][gPassword], 256, "");
gatesVariables[idx][gSpeed] = 2;
// Creating
format(string, sizeof(string), "Gate ID: %d", idx);
gatesVariables[idx][gGate] = CreateDynamicObject(gatesVariables[idx][gModel], gatesVariables[idx][gCX], gatesVariables[idx][gCY], gatesVariables[idx][gCZ], gatesVariables[idx][gCRX], gatesVariables[idx][gCRY], gatesVariables[idx][gCRZ]);
gatesVariables[idx][gText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, gatesVariables[idx][gCX], gatesVariables[idx][gCY], gatesVariables[idx][gCZ], 10);
// Text
format(string, sizeof(string), "AdmWarn: %s has created gate ID %d. (Object: %d)", GetPlayerName(playerid), idx, object);
submitToAdmins(string, COLOR_HOTORANGE);
adminLog(string);
idx = MAX_GATES;
}
}
return 1;
}