YCMD:hostroulette(playerid, params[]) {
new betmin,betmax;
new string[128];
new Text3D:roulette = Create3DTextLabel("CASINO", X11_ORANGE, 30.0, 40.0, 50.0, 40.0, 0);
if(!sscanf(playerid,params,"ii",betmin,betmax)) {
if(GetPVarInt(playerid,"hosting") == 1)
{
DeletePlayer3DTextLabel(playerid, roulette);
SendClientMessage(playerid, X11_TOMATO_2,"[CASINO] You stopped hosting roulette.");
SetPVarInt(playerid, "hosting", 0);
SetPVarInt(playerid, "MinimumBet", 0);
SetPVarInt(playerid, "MaximumBet", 0);
} else {
SetPVarInt(playerid, "MinimumBet", betmin);
SetPVarInt(playerid, "MaximumBet", betmax);
SetPVarInt(playerid, "hosting", 1);
Attach3DTextLabelToPlayer(roulette, playerid, 0.0, 0.0, 0.4);
format(string, sizeof(string), "Roulette Dealer\n $%d - $%d", betmin, betmax);
Update3DTextLabelText(roulette, X11_ORANGE, string);
}
} else {
SendClientMessage(playerid, X11_TOMATO_2,"[CASINO] /hostroulette [minimumbet] [maximumbet]");
}
if(IsPlayerInRangeOfPoint(playerid, 30.0, 2235.9666, 1613.1771, 1006.1797)) {
} else {
SendClientMessage(playerid, X11_TOMATO_2, "You are not in a casino or not close enough at the roulette tables!");
}
return 1;
}
|
Once the label is created it can't be destroyed because you use a local variable. In other words, the label exists in the world but its id is no longer stored anywhere. You must use a static variable instead. Probably a MAX_PLAYER array, as well.
|
new
Text3D: g_myLabel[MAX_PLAYERS]; // Global array (goes on top of your script before the includes. I meant after but wrote before, oops)
// Creating / attaching
g_myLabel[playerid] = Create3DTextLabel(...);
Attach3DTextLabelToPlayer(playerid, g_myLabel[playerid], ...);
// Destroying
Delete3DTextLabel(g_myLabel[playerid]);
|
PHP код:
|