31.08.2013, 16:33
Quote:
oque vocк colocou por ultimo no seu gm
se puder posta o code |
Код:
public cpinfos() { foreach(Player, i) { new Float:prevdist = 100000.000; new prevcp; for(new cpid=1; cpid < MAX_CHECKPOINTS; cpid++){ if(UsedCPSlot[cpid]) { new Float:dist; dist = CPSERVICE_getdist(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ]); if(dist < prevdist){ prevdist = dist; prevcp = cpid; } } } new cpid=prevcp; if(CPSERVICE_getdist(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ]) < Checkpoints[cpid][cpsd]) { if(CPSERVICE_actualcp[i] != cpid){ SetPlayerCheckpoint(i,Checkpoints[cpid][cpX],Checkpoints[cpid][cpY],Checkpoints[cpid][cpZ],Checkpoints[cpid][cpsz]); CPSERVICE_actualcp[i] = cpid; } } else { if(CPSERVICE_actualcp[i] != 0){ CPSERVICE_actualcp[i] = 0; DisablePlayerCheckpoint(i); } } } } stock CPS_AddCheckpoint(Float:X,Float:Y,Float:Z,Float:size,spawn_dist) { new cpid=1; while(UsedCPSlot[cpid] == 1) cpid++; if(CPSERVICE_active == 0){ CPSERVICE_active=1; } UsedCPSlot[cpid]=1; Checkpoints[cpid][cpX]=X; Checkpoints[cpid][cpY]=Y; Checkpoints[cpid][cpZ]=Z; Checkpoints[cpid][cpsz]=size; Checkpoints[cpid][cpsd]=spawn_dist; return cpid; } stock CPS_IsPlayerInCheckpoint(playerid,cpid) { if(!IsPlayerInCheckpoint(playerid)) return 0; if(CPSERVICE_actualcp[playerid] == cpid) return 1; else return 0; } stock CPS_IsPlayerInAnyCheckpoint(playerid) { if(!IsPlayerInCheckpoint(playerid)) return 0; if(CPSERVICE_actualcp[playerid] == 0) return 0; else return 1; } stock CPS_GetPlayerCheckpoint(playerid) if(!IsPlayerInCheckpoint(playerid)) return 0; else return CPSERVICE_actualcp[playerid]; stock CPS_RemoveCheckpoint(cpid) { if(cpid == 0 || UsedCPSlot[cpid] == 0) return 0; UsedCPSlot[cpid]=0; return 1; } stock IsVehicleOccupied(vehicleid) { for(new i; i < GetMaxPlayers(); i++) { if(IsPlayerConnected(i)) continue; if(GetPlayerVehicleID(i) == vehicleid) return 1; } return 0; } stock CPSERVICE_getdist(playerid,Float:x2,Float:y2,Float:z2) { new Float:x1,Float:y1,Float:z1; new Float:tmpdis; GetPlayerPos(playerid,x1,y1,z1); tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2)); return floatround(tmpdis); } stock GetNumberOfPlayersOnThisIP(test_ip[]) { new against_ip[32+1]; new x = 0; new ip_count = 0; for(x=0; x<MAX_PLAYERS; x++) { if(IsPlayerConnected(x)) { GetPlayerIp(x,against_ip,32); if(!strcmp(against_ip,test_ip)) ip_count++; } } return ip_count;