TextDrawShowForPlayer(playerid, Rules); new string[200], zone[MAX_ZONE_NAME]; GetPlayerName(playerid, string, MAX_PLAYER_NAME); GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME); Zone = TextDrawCreate(487.000000, 4.000000, "%s",zone);
warning 202: number of arguments does not match definition
Zone = TextDrawCreate(487.000000, 4.000000, "%s",zone);
Zone = TextDrawCreate(487.000000, 4.000000, " ");
// Then Later.
new string[128], zone[128];
format(string,sizeof(string),"%s",zone);
TextDrawSetString(Zone,string);
pawn Код:
|
public OnGameModeInit() Zone = TextDrawCreate(487.000000, 4.000000, " ");
public OnPlayerConnect(playerid) { new string1[128], zone[128]; GetPlayer2DZone(playerid, zone, MAX_ZONE_NAME); format(string1,sizeof(string1),"%s",zone); TextDrawSetString(Zone,string1);
new Text:zone[MAX_PLAYERS];
public OnGameModeInit(){
for(new i; i<MAX_PLAYERS; i++){
zone[i]=TextDrawCreate(487.000000, 4.000000, "San Andreas");
}
//This will create a text draw for every player.
//I recommend replacing MAX_PLAYERS with the actual maximum number of players you can have in your server
SetTimer("LocationTimer",2000,1);
//This will create a timer that will update the zones of every player every 2 seconds
return 1;
}
public OnPlayerConnect(playerid){
TextDrawShowForPlayer(playerid, zone[playerid]);
//Show the text draw for the player if not showing already
return 1;
}
forward LocationTimer(){
//If you have the foreach plugin, you should use that instead here
for(new i; i<MAX_PLAYERS; i++){
if(!IsPlayerConnected(i))continue;
//skip players not connected.
new zonename[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, zonename, MAX_ZONE_NAME);
TextDrawSetString(zone[i],zonename);
//Update the text draw with the player's zone
}
}
public OnPlayerDisconnect(playerid,reason){
TextDrawSetString(zone[playerid],"San Andreas");
//Reset the text in the text draw when the player disconnects
return 1;
}